I know questions about the syntax of template default arguments have been asked alot.
Usually, the answer (in sync with my understanding of how it should work) is to use something like that:
template <class T = SomeDefault> class T1 {};
Recently I wanted to check which map implementation Boost uses in its mapped_vector
. And found the following snippet:
template<class T, class A>
class mapped_vector:
Apparently, there is no default binding for the argument A
, but also apparently, I can instantiate a mapped_vector<int>
just fine. Obviosuly a default argument is inferred somehow, but how?
edit: Just to be precise, I am talking about line 279 in this file