1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef ALLOC_FIRST_H
10 #define ALLOC_FIRST_H
11 
12 #include <cassert>
13 
14 #include "allocators.h"
15 
16 struct alloc_first
17 {
18     static bool allocator_constructed;
19 
20     typedef A1<int> allocator_type;
21 
22     int data_;
23 
alloc_firstalloc_first24     alloc_first() : data_(0) {}
alloc_firstalloc_first25     alloc_first(int d) : data_(d) {}
alloc_firstalloc_first26     alloc_first(std::allocator_arg_t, const A1<int>& a)
27         : data_(0)
28     {
29         assert(a.id() == 5);
30         allocator_constructed = true;
31     }
32 
alloc_firstalloc_first33     alloc_first(std::allocator_arg_t, const A1<int>& a, int d)
34         : data_(d)
35     {
36         assert(a.id() == 5);
37         allocator_constructed = true;
38     }
39 
alloc_firstalloc_first40     alloc_first(std::allocator_arg_t, const A1<int>& a, const alloc_first& d)
41         : data_(d.data_)
42     {
43         assert(a.id() == 5);
44         allocator_constructed = true;
45     }
46 
~alloc_firstalloc_first47     ~alloc_first() {data_ = -1;}
48 
49     friend bool operator==(const alloc_first& x, const alloc_first& y)
50         {return x.data_ == y.data_;}
51     friend bool operator< (const alloc_first& x, const alloc_first& y)
52         {return x.data_ < y.data_;}
53 };
54 
55 bool alloc_first::allocator_constructed = false;
56 
57 #endif // ALLOC_FIRST_H
58