blob: 948f2a49976a6461af2a396d94a3d7cf80a9b473 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001#ifndef ALLOC_FIRST_H
2#define ALLOC_FIRST_H
3
4#include <cassert>
5
6#include "allocators.h"
7
8struct alloc_first
9{
10 static bool allocator_constructed;
11
12 typedef A1<int> allocator_type;
13
14 int data_;
15
16 alloc_first() : data_(0) {}
17 alloc_first(int d) : data_(d) {}
18 alloc_first(std::allocator_arg_t, const A1<int>& a)
19 : data_(0)
20 {
21 assert(a.id() == 5);
22 allocator_constructed = true;
23 }
24
25 alloc_first(std::allocator_arg_t, const A1<int>& a, int d)
26 : data_(d)
27 {
28 assert(a.id() == 5);
29 allocator_constructed = true;
30 }
31
32 alloc_first(std::allocator_arg_t, const A1<int>& a, const alloc_first& d)
33 : data_(d.data_)
34 {
35 assert(a.id() == 5);
36 allocator_constructed = true;
37 }
38
39 ~alloc_first() {data_ = -1;}
40
41 friend bool operator==(const alloc_first& x, const alloc_first& y)
42 {return x.data_ == y.data_;}
43 friend bool operator< (const alloc_first& x, const alloc_first& y)
44 {return x.data_ < y.data_;}
45};
46
47bool alloc_first::allocator_constructed = false;
48
Howard Hinnant94b2dd02010-08-22 00:59:46 +000049#endif // ALLOC_FIRST_H