Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2004-08-31 03:59:47


Jeff Garland wrote:

> On Mon, 30 Aug 2004 13:25:51 +0200, Markus Schöpflin wrote

...

>> [lib.facets.examples] doesn't say so but most examples I could find
>> either have a default constructor or a constructor taking a reference
>> count.
>
> I'm not sure where you are seeing these examples, but if you looking in
> libs/date_time/test/gregroian/testfacet.cpp I don't think you will find
> any default constructors.
>
> Maybe you can send me some of the errors you are getting -- onlist or
> off -- your choice?

I'll be trying to make myself more clear this time.

Currently, not all date_time tests compile with tru64cxx65. This is because
of a problem in the RW std library used on that platform. I now have
received a patch from HP which should fix the problem. But the patch now
requires a user defined facet to be default constructible, which the
date_time facets are not. Therefore, the tests still won't compile.

I now was wondering what the standard actually requires of a user defined
facet (IOW if the date_time facets are legal) and all I could find was
[lib.facets.examples] which isn't really much. Therefore I looked around a
little more for other examples of user defined facets (besides date_time)
and most of the examples I found were either default constructible or had a
constructor which takes a refs argument.

Therefore I decided to ask what the standard actually requires of a user
defined facet. Currently I'm thinking that both facets below are legal
according to the C++ standard and therefore that the error I'm still
getting on my platform is a problem of the std library and not of date_time.

---%<---
#include <locale>

struct foo : std::locale::facet
{
   static std::locale::id id;
};

struct bar : std::locale::facet
{
   static std::locale::id id;
   bar(int) { }
};

std::locale::id foo::id;
std::locale::id bar::id;

int main()
{
   std::use_facet<foo>(std::locale());
   std::use_facet<bar>(std::locale());
   return 0;
}
--->%---

Sorry for any confusion I might have caused...

Markus


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk