stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <>
Subject Re: [STDCXX-905] 22.locale.synopsis link error on Solaris platforms
Date Thu, 01 May 2008 20:29:42 GMT
Eric Lemings wrote:
> From what I see, the generic templates for member functions do_hash,
> do_transform, and do_compare() in the std::collate class are not defined
> anywhere: only the specialized templates for type char and wchar_t.  I
> assume this is intentional?  The 22.locale.synopsis test exercises these
> member functions with a user-defined character type (i.e. int type).

It sure does:

Hmm. The point of the test is to exercise the member template
operator() but it can't very well do that if the template is
incomplete. The standard leaves it unspecified whether the
implicit instantiation of a class template leads to the
instantiation of its virtual functions, and while some
compilers don't instantiate them Sun C++ (and Intel C++)
apparently does.

What we would need to do if we really wanted to exercise the
template is define a dummy explicit specialization of the
collate facet on a user-defined (non-fundamental) type such
as UserChar from rw_char.h and instantiate the template
operator on it. E.g., something like:

   namespace std {
     template <>
     struct collate<UserChar>: locale::facet {
         /* define all members as no-ops */

   // exercise a specialization other than on the default
   // char types
   typedef StringTypes<UserChar>::string_type UserString;

   MEMFUN (bool, operator(), (const UserString&, const UserString&) const);


View raw message