… | |
… | |
39 | { |
39 | { |
40 | g_slice_free1 (s, p); |
40 | g_slice_free1 (s, p); |
41 | } |
41 | } |
42 | }; |
42 | }; |
43 | |
43 | |
44 | void throw_bad_alloc () throw (std::bad_alloc); |
44 | // strictly the same as g_slice_alloc, but never returns 0 |
45 | |
|
|
46 | void *alloc (int s) throw (std::bad_alloc); |
45 | void *alloc (int s) throw (std::bad_alloc); |
|
|
46 | // for symmetry |
47 | void dealloc (void *p, int s) throw (); |
47 | inline void dealloc (void *p, int s) throw () |
|
|
48 | { |
|
|
49 | g_slice_free1 (s, p); |
|
|
50 | } |
48 | |
51 | |
49 | // a STL-compatible allocator that uses g_slice |
52 | // a STL-compatible allocator that uses g_slice |
50 | // boy, this is verbose |
53 | // boy, this is verbose |
51 | template<typename Tp> |
54 | template<typename Tp> |
52 | struct slice_allocator |
55 | struct slice_allocator |