Apparently VC2003 introduced this error, C2768, and VC2005 made matters worse. Anyway, here's the template definition:
Expand|Select|Wrap|Line Numbers
- template<class T>
- TiXmlBinding<T> const *
- GetTiXmlBinding( T const &, IdentityBase );
Expand|Select|Wrap|Line Numbers
- struct MyData
- {
- int i;
- double d;
- char const * s;
- std::vector<int> vec;
- int iref;
- void setIntvalue( int in ) {
- i = in;
- }
- int intvalue() {
- return i;
- }
- int & getIRef() {
- return iref;
- }
- };
Expand|Select|Wrap|Line Numbers
- TiXmlBinding<MyData> const *
- GetTiXmlBinding<MyData>( MyData const &, Identity<MyData> )
- {
- static MemberTiXmlBinding<MyData> binding;
- if( binding.empty() ) {
- binding.AddMember( "ITAG", Member(&MyData::i) );
- binding.AddMember( "ITAGGETSET", Member(&MyData::intvalue, &MyData::setIntvalue) );
- binding.AddMember( "DTAG", Member(&MyData::d) );
- binding.AddMember( "STAG", Member(&MyData::s) );
- binding.AddMember( "VEC", Member(&MyData::vec) );
- binding.AddMember( "IREF", Member(&MyData::getIRef) );
- }
- return &binding;
- }
(I'm not showing you the lengthy MemberTiXmlBinding class, because it seems pretty clear this is an issue of the function header, not its body. Right?)