Usermode/libc++ - Starting on a hacky STL implementation
[tpg/acess2.git] / Usermode / Libraries / libc++.so_src / include_exp / allocator
1 /*
2  * Acess2 C++ Library
3  * - By John Hodge (thePowersGang)
4  *
5  * string (header)
6  * - C++'s String type
7  */
8 #ifndef _LIBCXX_ALLOCATOR_
9 #define _LIBCXX_ALLOCATOR_
10
11 #include "cstddef"
12
13 namespace std {
14
15 template <class T> class allocator
16 {
17 public:
18         typedef T       value_type;
19         typedef T*      pointer;
20         typedef T&      reference;
21         typedef const T* const_pointer;
22         typedef const T&        const_reference;
23         typedef size_t  size_type;
24         typedef ptrdiff_t       difference_type;
25         
26         template <class Type>
27         struct rebind
28         {
29                 typedef allocator<Type> other;
30         };
31         
32         allocator() throw() {
33         }
34         allocator(const allocator& alloc) throw() {
35         }
36         template <class U>
37         allocator(const allocator<U>& alloc) throw() {
38         }
39         ~allocator() throw() {
40         }
41         
42         pointer address(reference x) const {
43                 return &x;
44         }
45         const_pointer address(const_reference x) const {
46                 return &x;
47         }
48         pointer allocate(size_type n, const void* hint=0) {
49                 ::operator new (n * sizeof(value_type));
50         }
51         void deallocate(pointer p, size_type n) {
52                 ::operator delete(p);
53         }
54 };
55
56 };
57
58 #endif
59
60 // vim: ft=cpp
61

UCC git Repository :: git.ucc.asn.au