diff --git a/compatibility.htm b/compatibility.htm index d520bd1..6f57e4d 100644 --- a/compatibility.htm +++ b/compatibility.htm @@ -1,88 +1,88 @@ - + -
-The February 2002 change to the Boost smart pointers introduced a number of - changes. Since the previous version of the smart pointers was in use for a long - time, it's useful to have a detailed list of what changed from a library user's - point of view.
-Note that for compilers that don't support member templates well enough, a - separate implementation is used that lacks many of the new features and is more - like the old version.
-Revised 1 February 2002
-Copyright 2002 Darin Adler. Distributed under the Boost Software License, Version - 1.0. See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt.
- + +The February 2002 change to the Boost smart pointers introduced a number of + changes. Since the previous version of the smart pointers was in use for a long + time, it's useful to have a detailed list of what changed from a library user's + point of view.
+Note that for compilers that don't support member templates well enough, a + separate implementation is used that lacks many of the new features and is more + like the old version.
+$Date$
+Copyright 2002 Darin Adler. Distributed under the Boost Software License, Version + 1.0. See accompanying file LICENSE_1_0.txt or + copy at http://www.boost.org/LICENSE_1_0.txt.
+ diff --git a/enable_shared_from_this.html b/enable_shared_from_this.html index c4caa25..028cf57 100644 --- a/enable_shared_from_this.html +++ b/enable_shared_from_this.html @@ -1,34 +1,24 @@ - + - - ![]() |
-
- enable_shared_from_this.hpp- |
-
- |
- The header <boost/enable_shared_from_this.hpp> defines - the class template enable_shared_from_this. It is used as a - base class that allows a shared_ptr to the current - object to be obtained from within a member function. -
-enable_shared_from_this<T> defines two member functions - called shared_from_this that return a shared_ptr<T> - and shared_ptr<T const>, depending on constness, to this.
-+ +enable_shared_from_this + + + ++
enable_shared_from_this
Purpose
++ The header <boost/enable_shared_from_this.hpp> defines + the class template enable_shared_from_this. It is used as a + base class that allows a shared_ptr to the current + object to be obtained from within a member function. +
+enable_shared_from_this<T> defines two member functions + called shared_from_this that return a shared_ptr<T> + and shared_ptr<T const>, depending on constness, to this.
+Example
+#include <boost/enable_shared_from_this.hpp> #include <boost/shared_ptr.hpp> #include <cassert> @@ -51,8 +41,8 @@ int main() assert(!(p < q || q < p)); // p and q must share ownership }-Synopsis
-+Synopsis
+namespace boost { @@ -66,30 +56,30 @@ public: }-template<class T> shared_ptr<T> - enable_shared_from_this<T>::shared_from_this();
-template<class T> shared_ptr<T const> - enable_shared_from_this<T>::shared_from_this() const;
---- Requires: enable_shared_from_this<T> must be an - accessible base class of T. *this must be a subobject - of an instance t of type T . There must exist - at least one shared_ptr instance p that owns - t. -
-- Returns: A shared_ptr<T> instance r that shares - ownership with p. -
-- Postconditions: r.get() == this. -
--
- +
- Copyright © 2002, 2003 by Peter Dimov. Distributed under the Boost Software License, Version - 1.0. See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt.template<class T> shared_ptr<T> + enable_shared_from_this<T>::shared_from_this();
+template<class T> shared_ptr<T const> + enable_shared_from_this<T>::shared_from_this() const;
++++ Requires: enable_shared_from_this<T> must be an + accessible base class of T. *this must be a subobject + of an instance t of type T . There must exist + at least one shared_ptr instance p that owns + t. +
++ Returns: A shared_ptr<T> instance r that shares + ownership with p. +
++ Postconditions: r.get() == this. +
+$Date$
++ Copyright © 2002, 2003 by Peter Dimov. Distributed under the Boost Software License, Version + 1.0. See accompanying file LICENSE_1_0.txt or + copy at http://www.boost.org/LICENSE_1_0.txt.
+ diff --git a/include/boost/make_unique.hpp b/include/boost/make_unique.hpp new file mode 100644 index 0000000..c163673 --- /dev/null +++ b/include/boost/make_unique.hpp @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2014 Glen Joseph Fernandes + * glenfe at live dot com + * + * Distributed under the Boost Software License, + * Version 1.0. (See accompanying file LICENSE_1_0.txt + * or copy at http://boost.org/LICENSE_1_0.txt) + */ +#ifndef BOOST_MAKE_UNIQUE_HPP_INCLUDED +#define BOOST_MAKE_UNIQUE_HPP_INCLUDED + +#include+ +#endif diff --git a/include/boost/smart_ptr/allocate_shared_array.hpp b/include/boost/smart_ptr/allocate_shared_array.hpp index 3ee1655..a27b99f 100644 --- a/include/boost/smart_ptr/allocate_shared_array.hpp +++ b/include/boost/smart_ptr/allocate_shared_array.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Glen Joseph Fernandes + * Copyright (c) 2012-2014 Glen Joseph Fernandes * glenfe at live dot com * * Distributed under the Boost Software License, @@ -9,14 +9,10 @@ #ifndef BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP #define BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP -#include -#include +#include #include -#include #include -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) -#include -#endif +#include namespace boost { template @@ -24,225 +20,140 @@ namespace boost { allocate_shared(const A& allocator, std::size_t size) { typedef typename boost::detail::array_inner ::type T1; typedef typename boost::detail::array_base ::type T2; + typedef typename boost::remove_cv ::type T3; + typedef boost::detail::as_allocator A1; + typedef boost::detail::as_deleter D1; T1* p1 = 0; - T2* p2 = 0; + T3* p2 = 0; std::size_t n1 = size * boost::detail::array_total ::size; - boost::detail::allocate_array_helper a1(allocator, n1, &p2); - boost::detail::array_deleter d1(n1); + D1 d1(allocator, n1); + A1 a1(allocator, n1, &p2); boost::shared_ptr s1(p1, d1, a1); - typedef boost::detail::array_deleter * D2; p1 = reinterpret_cast (p2); - D2 d2 = static_cast (s1._internal_get_untyped_deleter()); - d2->init(p2); + boost::detail::as_init(allocator, p2, n1); + D1* d2 = static_cast (s1._internal_get_untyped_deleter()); + d2->set(p2); return boost::shared_ptr (s1, p1); } -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - template - inline typename boost::detail::sp_if_array ::type - allocate_shared(const A& allocator, std::size_t size, Args&&... args) { - typedef typename boost::detail::array_inner ::type T1; - typedef typename boost::detail::array_base ::type T2; - T1* p1 = 0; - T2* p2 = 0; - std::size_t n1 = size * boost::detail::array_total ::size; - boost::detail::allocate_array_helper a1(allocator, n1, &p2); - boost::detail::array_deleter d1(n1); - boost::shared_ptr s1(p1, d1, a1); - typedef boost::detail::array_deleter * D2; - p1 = reinterpret_cast (p2); - D2 d2 = static_cast (s1._internal_get_untyped_deleter()); - d2->init(p2, boost::detail::sp_forward (args)...); - return boost::shared_ptr (s1, p1); - } - template - inline typename boost::detail::sp_if_size_array ::type - allocate_shared(const A& allocator, Args&&... args) { - typedef typename boost::detail::array_inner ::type T1; - typedef typename boost::detail::array_base ::type T2; - enum { - N = boost::detail::array_total ::size - }; - T1* p1 = 0; - T2* p2 = 0; - boost::detail::allocate_array_helper a1(allocator, &p2); - boost::detail::array_deleter d1; - boost::shared_ptr s1(p1, d1, a1); - typedef boost::detail::array_deleter * D2; - p1 = reinterpret_cast (p2); - D2 d2 = static_cast (s1._internal_get_untyped_deleter()); - d2->init(p2, boost::detail::sp_forward (args)...); - return boost::shared_ptr (s1, p1); - } -#endif -#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) + template inline typename boost::detail::sp_if_size_array ::type - allocate_shared(const A& allocator, const T& list) { + allocate_shared(const A& allocator) { typedef typename boost::detail::array_inner ::type T1; typedef typename boost::detail::array_base ::type T2; - typedef const T2 T3; + typedef typename boost::remove_cv ::type T3; enum { N = boost::detail::array_total ::size }; + typedef boost::detail::as_allocator A1; + typedef boost::detail::as_deleter D1; T1* p1 = 0; - T2* p2 = 0; - T3* p3 = 0; - boost::detail::allocate_array_helper a1(allocator, &p2); - boost::detail::array_deleter d1; + T3* p2 = 0; + D1 d1(allocator); + A1 a1(allocator, &p2); boost::shared_ptr s1(p1, d1, a1); - typedef boost::detail::array_deleter * D2; - p3 = reinterpret_cast (list); p1 = reinterpret_cast (p2); - D2 d2 = static_cast (s1._internal_get_untyped_deleter()); - d2->init_list(p2, p3); + boost::detail::as_init(allocator, p2, N); + D1* d2 = static_cast (s1._internal_get_untyped_deleter()); + d2->set(p2); return boost::shared_ptr (s1, p1); } + template inline typename boost::detail::sp_if_array ::type allocate_shared(const A& allocator, std::size_t size, - const typename boost::detail::array_inner ::type& list) { + const typename boost::detail::array_inner ::type& value) { typedef typename boost::detail::array_inner ::type T1; typedef typename boost::detail::array_base ::type T2; - typedef const T2 T3; + typedef typename boost::remove_cv ::type T3; + typedef const T2 T4; + typedef boost::detail::as_allocator A1; + typedef boost::detail::as_deleter D1; enum { M = boost::detail::array_total ::size }; T1* p1 = 0; - T2* p2 = 0; - T3* p3 = 0; + T3* p2 = 0; + T4* p3 = reinterpret_cast (&value); std::size_t n1 = M * size; - boost::detail::allocate_array_helper a1(allocator, n1, &p2); - boost::detail::array_deleter d1(n1); + D1 d1(allocator, n1); + A1 a1(allocator, n1, &p2); boost::shared_ptr s1(p1, d1, a1); - typedef boost::detail::array_deleter * D2; - p3 = reinterpret_cast (list); p1 = reinterpret_cast (p2); - D2 d2 = static_cast (s1._internal_get_untyped_deleter()); - d2->template init_list (p2, p3); + boost::detail::as_init (allocator, p2, n1, p3); + D1* d2 = static_cast (s1._internal_get_untyped_deleter()); + d2->set(p2); return boost::shared_ptr (s1, p1); } + template inline typename boost::detail::sp_if_size_array ::type - allocate_shared(const A& allocator, - const typename boost::detail::array_inner ::type& list) { + allocate_shared(const A& allocator, + const typename boost::detail::array_inner ::type& value) { typedef typename boost::detail::array_inner ::type T1; typedef typename boost::detail::array_base ::type T2; - typedef const T2 T3; + typedef typename boost::remove_cv ::type T3; + typedef const T2 T4; enum { M = boost::detail::array_total ::size, N = boost::detail::array_total ::size }; + typedef boost::detail::as_allocator A1; + typedef boost::detail::as_deleter D1; T1* p1 = 0; - T2* p2 = 0; - T3* p3 = 0; - boost::detail::allocate_array_helper a1(allocator, &p2); - boost::detail::array_deleter d1; + T3* p2 = 0; + T4* p3 = reinterpret_cast (&value); + D1 d1(allocator); + A1 a1(allocator, &p2); boost::shared_ptr s1(p1, d1, a1); - typedef boost::detail::array_deleter * D2; - p3 = reinterpret_cast (list); p1 = reinterpret_cast (p2); - D2 d2 = static_cast (s1._internal_get_untyped_deleter()); - d2->template init_list (p2, p3); + boost::detail::as_init (allocator, p2, N, p3); + D1* d2 = static_cast (s1._internal_get_untyped_deleter()); + d2->set(p2); return boost::shared_ptr (s1, p1); } -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - template - inline typename boost::detail::sp_if_array ::type - allocate_shared(const A& allocator, - std::initializer_list ::type> list) { - typedef typename boost::detail::array_inner ::type T1; - typedef typename boost::detail::array_base ::type T2; - typedef const T2 T3; - T1* p1 = 0; - T2* p2 = 0; - T3* p3 = 0; - std::size_t n1 = list.size() * boost::detail::array_total ::size; - boost::detail::allocate_array_helper a1(allocator, n1, &p2); - boost::detail::array_deleter d1(n1); - boost::shared_ptr s1(p1, d1, a1); - typedef boost::detail::array_deleter * D2; - p3 = reinterpret_cast (list.begin()); - p1 = reinterpret_cast (p2); - D2 d2 = static_cast (s1._internal_get_untyped_deleter()); - d2->init_list(p2, p3); - return boost::shared_ptr (s1, p1); - } -#endif -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - template - inline typename boost::detail::sp_if_array ::type - allocate_shared(const A& allocator, std::size_t size, - typename boost::detail::array_base ::type&& value) { - typedef typename boost::detail::array_inner ::type T1; - typedef typename boost::detail::array_base ::type T2; - T1* p1 = 0; - T2* p2 = 0; - std::size_t n1 = size * boost::detail::array_total ::size; - boost::detail::allocate_array_helper a1(allocator, n1, &p2); - boost::detail::array_deleter d1(n1); - boost::shared_ptr s1(p1, d1, a1); - typedef boost::detail::array_deleter * D2; - p1 = reinterpret_cast (p2); - D2 d2 = static_cast (s1._internal_get_untyped_deleter()); - d2->init(p2, boost::detail::sp_forward (value)); - return boost::shared_ptr (s1, p1); - } - template - inline typename boost::detail::sp_if_size_array ::type - allocate_shared(const A& allocator, - typename boost::detail::array_base ::type&& value) { - typedef typename boost::detail::array_inner ::type T1; - typedef typename boost::detail::array_base ::type T2; - enum { - N = boost::detail::array_total ::size - }; - T1* p1 = 0; - T2* p2 = 0; - boost::detail::allocate_array_helper a1(allocator, &p2); - boost::detail::array_deleter d1; - boost::shared_ptr s1(p1, d1, a1); - typedef boost::detail::array_deleter * D2; - p1 = reinterpret_cast (p2); - D2 d2 = static_cast (s1._internal_get_untyped_deleter()); - d2->init(p2, boost::detail::sp_forward (value)); - return boost::shared_ptr (s1, p1); - } -#endif -#endif + template inline typename boost::detail::sp_if_array ::type allocate_shared_noinit(const A& allocator, std::size_t size) { typedef typename boost::detail::array_inner ::type T1; typedef typename boost::detail::array_base ::type T2; + typedef typename boost::remove_cv ::type T3; + typedef boost::detail::as_allocator A1; + typedef boost::detail::ms_deleter D1; T1* p1 = 0; - T2* p2 = 0; + T3* p2 = 0; std::size_t n1 = size * boost::detail::array_total ::size; - boost::detail::allocate_array_helper a1(allocator, n1, &p2); - boost::detail::array_deleter d1(n1); + D1 d1(n1); + A1 a1(allocator, n1, &p2); boost::shared_ptr s1(p1, d1, a1); - typedef boost::detail::array_deleter * D2; p1 = reinterpret_cast (p2); - D2 d2 = static_cast (s1._internal_get_untyped_deleter()); - d2->noinit(p2); + boost::detail::ms_noinit(p2, n1); + D1* d2 = static_cast (s1._internal_get_untyped_deleter()); + d2->set(p2); return boost::shared_ptr (s1, p1); } + template inline typename boost::detail::sp_if_size_array ::type allocate_shared_noinit(const A& allocator) { typedef typename boost::detail::array_inner ::type T1; typedef typename boost::detail::array_base ::type T2; + typedef typename boost::remove_cv ::type T3; enum { N = boost::detail::array_total ::size }; + typedef boost::detail::as_allocator A1; + typedef boost::detail::ms_deleter D1; T1* p1 = 0; - T2* p2 = 0; - boost::detail::allocate_array_helper a1(allocator, &p2); - boost::detail::array_deleter d1; + T3* p2 = 0; + D1 d1; + A1 a1(allocator, &p2); boost::shared_ptr s1(p1, d1, a1); - typedef boost::detail::array_deleter * D2; p1 = reinterpret_cast (p2); - D2 d2 = static_cast (s1._internal_get_untyped_deleter()); - d2->noinit(p2); + boost::detail::ms_noinit(p2, N); + D1* d2 = static_cast (s1._internal_get_untyped_deleter()); + d2->set(p2); return boost::shared_ptr (s1, p1); } } diff --git a/include/boost/smart_ptr/detail/allocate_array_helper.hpp b/include/boost/smart_ptr/detail/allocate_array_helper.hpp deleted file mode 100644 index 2eeea2d..0000000 --- a/include/boost/smart_ptr/detail/allocate_array_helper.hpp +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2012 Glen Joseph Fernandes - * glenfe at live dot com - * - * Distributed under the Boost Software License, - * Version 1.0. (See accompanying file LICENSE_1_0.txt - * or copy at http://boost.org/LICENSE_1_0.txt) - */ -#ifndef BOOST_SMART_PTR_DETAIL_ALLOCATE_ARRAY_HELPER_HPP -#define BOOST_SMART_PTR_DETAIL_ALLOCATE_ARRAY_HELPER_HPP - -#include - -namespace boost { - namespace detail { - template - class allocate_array_helper; - template - class allocate_array_helper { - template - friend class allocate_array_helper; - typedef typename A::template rebind ::other A2; - typedef typename A::template rebind ::other A3; - public: - typedef typename A2::value_type value_type; - typedef typename A2::pointer pointer; - typedef typename A2::const_pointer const_pointer; - typedef typename A2::reference reference; - typedef typename A2::const_reference const_reference; - typedef typename A2::size_type size_type; - typedef typename A2::difference_type difference_type; - template - struct rebind { - typedef allocate_array_helper other; - }; - allocate_array_helper(const A& allocator_, std::size_t size_, T** data_) - : allocator(allocator_), - size(sizeof(T) * size_), - data(data_) { - } - template - allocate_array_helper(const allocate_array_helper& other) - : allocator(other.allocator), - size(other.size), - data(other.data) { - } - pointer address(reference value) const { - return allocator.address(value); - } - const_pointer address(const_reference value) const { - return allocator.address(value); - } - size_type max_size() const { - return allocator.max_size(); - } - pointer allocate(size_type count, const void* value = 0) { - std::size_t a1 = boost::alignment_of ::value; - std::size_t n1 = count * sizeof(Y) + a1 - 1; - char* p1 = A3(allocator).allocate(n1 + size, value); - char* p2 = p1 + n1; - while (std::size_t(p2) % a1 != 0) { - p2--; - } - *data = reinterpret_cast (p2); - return reinterpret_cast (p1); - } - void deallocate(pointer memory, size_type count) { - std::size_t a1 = boost::alignment_of ::value; - std::size_t n1 = count * sizeof(Y) + a1 - 1; - char* p1 = reinterpret_cast (memory); - A3(allocator).deallocate(p1, n1 + size); - } - void construct(pointer memory, const Y& value) { - allocator.construct(memory, value); - } - void destroy(pointer memory) { - allocator.destroy(memory); - } - template - bool operator==(const allocate_array_helper& other) const { - return allocator == other.allocator; - } - template - bool operator!=(const allocate_array_helper& other) const { - return !(*this == other); - } - private: - A2 allocator; - std::size_t size; - T** data; - }; - template - class allocate_array_helper { - template - friend class allocate_array_helper; - typedef typename A::template rebind ::other A2; - typedef typename A::template rebind ::other A3; - public: - typedef typename A2::value_type value_type; - typedef typename A2::pointer pointer; - typedef typename A2::const_pointer const_pointer; - typedef typename A2::reference reference; - typedef typename A2::const_reference const_reference; - typedef typename A2::size_type size_type; - typedef typename A2::difference_type difference_type; - template - struct rebind { - typedef allocate_array_helper other; - }; - allocate_array_helper(const A& allocator_, T** data_) - : allocator(allocator_), - data(data_) { - } - template - allocate_array_helper(const allocate_array_helper& other) - : allocator(other.allocator), - data(other.data) { - } - pointer address(reference value) const { - return allocator.address(value); - } - const_pointer address(const_reference value) const { - return allocator.address(value); - } - size_type max_size() const { - return allocator.max_size(); - } - pointer allocate(size_type count, const void* value = 0) { - std::size_t a1 = boost::alignment_of ::value; - std::size_t n1 = count * sizeof(Y) + a1 - 1; - char* p1 = A3(allocator).allocate(n1 + N1, value); - char* p2 = p1 + n1; - while (std::size_t(p2) % a1 != 0) { - p2--; - } - *data = reinterpret_cast (p2); - return reinterpret_cast (p1); - } - void deallocate(pointer memory, size_type count) { - std::size_t a1 = boost::alignment_of ::value; - std::size_t n1 = count * sizeof(Y) + a1 - 1; - char* p1 = reinterpret_cast (memory); - A3(allocator).deallocate(p1, n1 + N1); - } - void construct(pointer memory, const Y& value) { - allocator.construct(memory, value); - } - void destroy(pointer memory) { - allocator.destroy(memory); - } - template - bool operator==(const allocate_array_helper& other) const { - return allocator == other.allocator; - } - template - bool operator!=(const allocate_array_helper& other) const { - return !(*this == other); - } - private: - enum { - N1 = N * sizeof(T) - }; - A2 allocator; - T** data; - }; - } -} - -#endif diff --git a/include/boost/smart_ptr/detail/allocator_pair.hpp b/include/boost/smart_ptr/detail/allocator_pair.hpp new file mode 100644 index 0000000..8910c90 --- /dev/null +++ b/include/boost/smart_ptr/detail/allocator_pair.hpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 Glen Joseph Fernandes + * glenfe at live dot com + * + * Distributed under the Boost Software License, + * Version 1.0. (See accompanying file LICENSE_1_0.txt + * or copy at http://boost.org/LICENSE_1_0.txt) + */ +#ifndef BOOST_SMART_PTR_DETAIL_ALLOCATOR_PAIR_HPP +#define BOOST_SMART_PTR_DETAIL_ALLOCATOR_PAIR_HPP + +#include + +namespace boost { + namespace detail { + template + struct as_pair + : A { + as_pair(const A& allocator, const T& value) + : A(allocator), + data(value) { + } + + T data; + }; + } +} + +#endif diff --git a/include/boost/smart_ptr/detail/array_allocator.hpp b/include/boost/smart_ptr/detail/array_allocator.hpp new file mode 100644 index 0000000..cca57b7 --- /dev/null +++ b/include/boost/smart_ptr/detail/array_allocator.hpp @@ -0,0 +1,293 @@ +/* + * Copyright (c) 2012-2014 Glen Joseph Fernandes + * glenfe at live dot com + * + * Distributed under the Boost Software License, + * Version 1.0. (See accompanying file LICENSE_1_0.txt + * or copy at http://boost.org/LICENSE_1_0.txt) + */ +#ifndef BOOST_SMART_PTR_DETAIL_ARRAY_ALLOCATOR_HPP +#define BOOST_SMART_PTR_DETAIL_ARRAY_ALLOCATOR_HPP + +#include +#include +#include +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +#include +#endif + +namespace boost { + namespace detail { + template + struct ms_allocator_base; + + template + struct ms_allocator_base { + ms_allocator_base(std::size_t size_) + : size(size_ * sizeof(T)) { + } + + std::size_t size; + }; + + template + struct ms_allocator_base { + enum { + size = N * sizeof(T) + }; + }; + + template + class as_allocator + : ms_allocator_base { + using ms_allocator_base ::size; + + template + friend class as_allocator; + +#if !defined(BOOST_NO_CXX11_ALLOCATOR) + typedef typename std::allocator_traits:: + template rebind_alloc YA; + typedef typename std::allocator_traits:: + template rebind_alloc CA; + typedef typename std::allocator_traits:: + template rebind_traits YT; + typedef typename std::allocator_traits:: + template rebind_traits CT; +#else + typedef typename A::template rebind ::other YA; + typedef typename A::template rebind ::other CA; +#endif + + public: + typedef typename array_inner ::type type; + +#if !defined(BOOST_NO_CXX11_ALLOCATOR) + typedef typename YT::value_type value_type; + typedef typename YT::pointer pointer; + typedef typename YT::const_pointer const_pointer; + typedef typename YT::size_type size_type; + typedef typename YT::difference_type difference_type; + typedef Y& reference; + typedef const Y& const_reference; +#else + typedef typename YA::value_type value_type; + typedef typename YA::pointer pointer; + typedef typename YA::const_pointer const_pointer; + typedef typename YA::size_type size_type; + typedef typename YA::difference_type difference_type; + typedef typename YA::reference reference; + typedef typename YA::const_reference const_reference; +#endif + + template + struct rebind { + typedef as_allocator other; + }; + + as_allocator(const A& allocator, type** data) + : pair(allocator, data) { + } + + as_allocator(const A& allocator, std::size_t size_, type** data) + : ms_allocator_base (size_), + pair(allocator, data) { + } + + template