Quantcast
Channel: User Karthik T - Stack Overflow
Viewing all articles
Browse latest Browse all 42

Answer by Karthik T for Why doesn't const A & bind to A() in template arguments?

$
0
0

Possible duplicate of Non-type template parameters

These are the rules of template non type parameters

A non-type template-parameter shall have one of the following (optionally cv-qualified) types:

  • integral or enumeration type,
  • pointer to object or pointer to function,
  • lvalue reference to object or lvalue reference to function,
  • pointer to member,
  • std::nullptr_t.

What you are passing is an RValue (temporary object, etc which cannot be assigned to), which does not fall under any of these possibilities.

edit:

It appears that it is infact being interpreted as a function type, but your template signature expects a non type parameter of type A (exactly a const A&)


Viewing all articles
Browse latest Browse all 42

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>