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_LAST_H
11#define ALLOC_LAST_H
12
13#include <cassert>
14
15#include "allocators.h"
16
17struct alloc_last
18{
19    static bool allocator_constructed;
20
21    typedef A1<int> allocator_type;
22
23    int data_;
24
25    alloc_last() : data_(0) {}
26    alloc_last(int d) : data_(d) {}
27    alloc_last(const A1<int>& a)
28        : data_(0)
29    {
30        assert(a.id() == 5);
31        allocator_constructed = true;
32    }
33
34    alloc_last(int d, const A1<int>& a)
35        : data_(d)
36    {
37        assert(a.id() == 5);
38        allocator_constructed = true;
39    }
40
41    alloc_last(const alloc_last& d, const A1<int>& a)
42        : data_(d.data_)
43    {
44        assert(a.id() == 5);
45        allocator_constructed = true;
46    }
47
48    ~alloc_last() {data_ = -1;}
49
50    friend bool operator==(const alloc_last& x, const alloc_last& y)
51        {return x.data_ == y.data_;}
52    friend bool operator< (const alloc_last& x, const alloc_last& y)
53        {return x.data_ < y.data_;}
54};
55
56bool alloc_last::allocator_constructed = false;
57
58#endif  // ALLOC_LAST_H
59