0

I am coding inside a template class

template<typename K, typename V>
class MyMap {
   ...
   std::map<K, V> m_map;

and wishing to write

   m_map.insert(...

but CLion code completion inserts for me

   m_map.template insert()

Is this a bug or a new C++ syntax? If new syntax, then what is it?

Dims
  • 47,675
  • 117
  • 331
  • 600
  • I don't think this is new syntax, just more verbose. Not sure if there is any ambiguity that can be solved using the long form https://godbolt.org/z/4EncEvToz. – Timo May 04 '21 at 07:14
  • Furthermore, a lot of `insert` overloads are not templates as we can see here: https://en.cppreference.com/w/cpp/container/map/insert – Rerito May 04 '21 at 07:15
  • note that visual studio doesn't accept this code: https://godbolt.org/z/4eoPKx45q – Alan Birtles May 04 '21 at 07:17
  • @Timo sorry, I meant "new for me" of course. What is the name of this construct? – Dims May 05 '21 at 07:51

0 Answers0