On 9/15/12 1:47 AM, Stefan Teleman wrote: > On Thu, Sep 13, 2012 at 1:40 AM, Stefan Teleman > wrote: > >> The performance of 22.locale.numpunct.mt is also much better with your >> _numpunct.h patch: >> >> real 668.93 >> user 804.00 >> sys 34.24 > > Unfortunately, the resulting facet is non-conformant. For this simple test case: > > #include > > #include > #include > > template > class my_numpunct : public std::numpunct<_CharT> > { > public: > typedef _CharT char_type; > > explicit my_numpunct<_CharT>() : std::numpunct<_CharT>() { } > ~my_numpunct () { } > > protected: > virtual char_type do_decimal_point () const { > std::printf("Hello, my name is my_numpunct::do_decimal_point.\n"); > return std::numpunct<_CharT>::do_decimal_point (); > } > > virtual std::string do_grouping () const { > std::printf("Hello, my name is my_numpunct::do_grouping.\n"); > return std::numpunct<_CharT>::do_grouping (); > } > }; > > int > main(int argc, char* argv[]) > { > > if (argc != 2) { > std::fprintf(stderr, "Usage: %s \n", argv[0]); > return -1; > } > > std::locale l(argv[1]); > std::locale loc(l, new my_numpunct ()); > > my_numpunct const& fac = > std::use_facet > (loc); > > char dp = fac.decimal_point(); > char ts = fac.thousands_sep(); > std::string gr = fac.grouping(); > std::string tn = fac.truename(); > > std::fprintf(stderr, "dp = '%c' ts = '%c' gr = \"%s\" tn = \"%s\"\n", > dp, ts, gr.c_str(), tn.c_str()); > > return 0; > } > > I expect the following output: That is funny. What compiler are you using? What does the following test case return for you? template< typename T > struct S { int f () const { return g (); } virtual int g () const { return 1; } }; template< typename T > struct U : S< T > { int g () const { return S< T >::g () - 1; } }; int main () { return U< char > ().f (); } Thanks. Liviu > > [steleman@darthvader][/src/steleman/programming/stdcxx-ss122/stdcxx-4.2.1/tests/localization][09/15/2012 > 1:44:35][1134]>> ./22.locale.numpunct.stefan-1-gcc en_US.utf-8 > Hello, my name is my_numpunct::do_decimal_point. > Hello, my name is my_numpunct::do_grouping. > dp = '.' ts = ',' gr = "" tn = "true" > > I get this instead: > > [steleman@darthvader][/src/steleman/programming/stdcxx-intel/stdcxx-4.2.1-thread-safe/build/tests][09/14/2012 > 22:31:22][1449]>> ./22.locale.numpunct.stefan-1 en_US.utf-8 > dp = '.' ts = ',' gr = "" tn = "true" > > --Stefan >