alloc_first.h revision bc8d3f97eb5c958007f2713238472e0c1c8fe02c
1#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 49#endif 50