1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef ALLOC_FIRST_H 11 #define ALLOC_FIRST_H 12 13 #include <cassert> 14 15 #include "allocators.h" 16 17 struct alloc_first 18 { 19 static bool allocator_constructed; 20 21 typedef A1<int> allocator_type; 22 23 int data_; 24 alloc_firstalloc_first25 alloc_first() : data_(0) {} alloc_firstalloc_first26 alloc_first(int d) : data_(d) {} alloc_firstalloc_first27 alloc_first(std::allocator_arg_t, const A1<int>& a) 28 : data_(0) 29 { 30 assert(a.id() == 5); 31 allocator_constructed = true; 32 } 33 alloc_firstalloc_first34 alloc_first(std::allocator_arg_t, const A1<int>& a, int d) 35 : data_(d) 36 { 37 assert(a.id() == 5); 38 allocator_constructed = true; 39 } 40 alloc_firstalloc_first41 alloc_first(std::allocator_arg_t, const A1<int>& a, const alloc_first& d) 42 : data_(d.data_) 43 { 44 assert(a.id() == 5); 45 allocator_constructed = true; 46 } 47 ~alloc_firstalloc_first48 ~alloc_first() {data_ = -1;} 49 50 friend bool operator==(const alloc_first& x, const alloc_first& y) 51 {return x.data_ == y.data_;} 52 friend bool operator< (const alloc_first& x, const alloc_first& y) 53 {return x.data_ < y.data_;} 54 }; 55 56 bool alloc_first::allocator_constructed = false; 57 58 #endif // ALLOC_FIRST_H 59