1 // (C) Copyright John Maddock 2001.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 // See http://www.boost.org/libs/config for most recent version.
8 // MACRO: BOOST_HAS_PARTIAL_STD_ALLOCATOR
9 // TITLE: limited std::allocator support
10 // DESCRIPTION: The std lib has at least some kind of stanfard allocator
11 // with allocate/deallocate members and probably not much more.
15 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)))
16 # define BOOST_UNUSED_ATTRIBUTE __attribute__((unused))
18 # define BOOST_UNUSED_ATTRIBUTE
21 namespace boost_has_partial_std_allocator{
24 // test everything except rebind template members:
28 int test_allocator(const T& i)
30 typedef std::allocator<int> alloc1_t;
31 typedef typename alloc1_t::size_type size_type;
32 typedef typename alloc1_t::difference_type difference_type BOOST_UNUSED_ATTRIBUTE;
33 typedef typename alloc1_t::pointer pointer;
34 typedef typename alloc1_t::const_pointer const_pointer;
35 typedef typename alloc1_t::reference reference;
36 typedef typename alloc1_t::const_reference const_reference;
37 typedef typename alloc1_t::value_type value_type BOOST_UNUSED_ATTRIBUTE;
41 pointer p = a1.allocate(1);
44 size_type s = a1.max_size();
47 const_reference cr = *cp;
48 if(p != a1.address(r)) return -1;
49 if(cp != a1.address(cr)) return -1;
59 return test_allocator(0);
64 #undef BOOST_UNUSED_ATTRIBUTE