It is not possible to write a constructor for bag::iterator , because an iterator is a typedef name that cannot be used as constructor names:
14882:2003 12.1/3
the typedef name that names the class should not be used as an identifier in the declarator to declare the constructor.
There is even an example in the standard, although in another paragraph 7.1.3/5 :
typedef struct { S();
You will need to specify this structure name if you want a custom constructor. Programming style typedef struct { } name; usually not recommended with C ++ style manuals in favor of struct name { }; .
Cubbi
source share