Return-Path: X-Original-To: apmail-stdcxx-dev-archive@www.apache.org Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 873AFD1C1 for ; Sat, 15 Sep 2012 13:01:59 +0000 (UTC) Received: (qmail 20307 invoked by uid 500); 15 Sep 2012 13:01:59 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 20082 invoked by uid 500); 15 Sep 2012 13:01:52 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 20039 invoked by uid 99); 15 Sep 2012 13:01:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Sep 2012 13:01:51 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [64.34.174.152] (HELO hates.ms) (64.34.174.152) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Sep 2012 13:01:44 +0000 Received: from [2.128.155.86] (unknown [206.197.31.227]) by hates.ms (Postfix) with ESMTPSA id 3DCCF45C1AB for ; Sat, 15 Sep 2012 13:01:23 +0000 (UTC) Message-ID: <50547C22.1000604@hates.ms> Date: Sat, 15 Sep 2012 09:01:22 -0400 From: Liviu Nicoara User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: STDCXX-1056 [was: Re: STDCXX forks] References: <40394653-8FCC-4D04-A108-2C650AF8F95B@hates.ms> <50481DDC.6010906@gmail.com> <5048A224.7060402@hates.ms> <5048CC76.5060603@gmail.com> <5049016D.8000902@gmail.com> <504E2440.1060706@gmail.com> <504FE7F9.90102@gmail.com> <504FF10E.8020506@hates.ms> <50508849.4070708@hates.ms> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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 >