Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
27.streambuf.imbue.stdcxx-307.cpp
Go to the documentation of this file.
1
27#include <cassert>
28#include <locale>
29#include <streambuf>
30
31struct MyFacet: std::locale::facet
32{
33 static std::locale::id id;
34};
35
36std::locale::id MyFacet::id;
37
38int main ()
39{
40 struct MyBuf: std::streambuf {
41 void imbue (const std::locale &loc) {
42 std::streambuf::imbue (loc);
43 }
44 } buf;
45
46 const std::locale loc (buf.getloc (), new MyFacet);
47
49 assert (!_STD_HAS_FACET (MyFacet, buf.getloc ()));
50
51 buf.imbue (loc);
52
53 assert (!_STD_HAS_FACET (MyFacet, buf.getloc ()));
54
55 buf.pubimbue (loc);
56
57 assert (_STD_HAS_FACET (MyFacet, buf.getloc ()));
58
59 return 0;
60}
#define loc
Definition 17.names.cpp:492
#define buf
Definition 17.names.cpp:452
#define assert(expr)
Definition _cassert.h:40
#define _STD_HAS_FACET(type, arg)
Definition _defs.h:917
static std::locale::id id
Definition has_facet.cpp:40