Hi Henrik, > > Odd... std::string::npos is declared as follows: > > namespace std; > > template<class _Elem, > class _Traits, > class _Ax> > class basic_string > : public _String_val<_Elem, _Ax> > { > public: > static const size_type npos; > }; > > template<class _Elem, > class _Traits, > class _Alloc> > const typename basic_string<_Elem, _Traits, _Alloc>::size_type > basic_string<_Elem, _Traits, _Alloc>::npos = > (typename basic_string<_Elem, _Traits, > _Alloc>::size_type)(-1); > > typedef basic_string<char, char_traits<char>, allocator<char> > > string; > > > > Maybe Visual Studio drops the const attribute when trying to convert the > value from "const std::string:size_type" to "const String::size_type" > and gets lost somehow, even with the value as such being a simple size_t > integer.. > > What does it say about the attached code? My attempt in isolating the > String npos = std::string::npos code with as little change as possible > (had to kill the char_traits thing as that used template syntax not > accepted by G++ which slightly changes how size_type is declared) >
It fails: vs_string.cc c:\work\vc_string\vs_string.cc(1) : error C2371: 'size_t' : redefinition; different basic types c:\work\vc_string\vs_string.cc : see declaration of 'size_t' c:\work\vc_string\vs_string.cc(34) : error C2057: expected constant expression A comment to line 1 fixes only the first redefinition error. Do you need the preprocessed source ? Regards Guido Serassio Acme Consulting S.r.l. Microsoft Gold Certified Partner Via Lucia Savarino, 1 10098 - Rivoli (TO) - ITALY Tel. : +39.011.9530135 Fax. : +39.011.9781115 Email: guido.seras...@acmeconsulting.it WWW: http://www.acmeconsulting.it