Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
23.list.special.stdcxx-334.cpp
Go to the documentation of this file.
1
27#include <list>
28#include <string>
29#include <cassert>
30
31class Alloc : public std::allocator <char>
32{
33};
34
36{
37 return false;
38}
39
41{
42 return true;
43}
44
45
46int main ()
47{
48 const char src [] = "source string";
49 const char dst [] = "destination string";
50
51 typedef std::list <char, Alloc> List;
52
53 Alloc a1;
54 Alloc a2;
55
56 assert (!(a1 == a2));
57
58 List src_lst (src, src + sizeof (src) - 1, a1);
59 List dst_lst (dst, dst + sizeof (dst) - 1, a2);
60
61 src_lst.swap (dst_lst);
62
63 assert (std::string (src_lst.begin (), src_lst.end ()) == dst);
64 assert (std::string (dst_lst.begin (), dst_lst.end ()) == src);
65
66 return 0;
67}
#define a2
Definition 17.names.cpp:251
#define a1
Definition 17.names.cpp:225
bool operator!=(Alloc, Alloc)
bool operator==(Alloc, Alloc)
#define assert(expr)
Definition _cassert.h:40