2 * Copyright (c) 2014 Glen Joseph Fernandes
3 * glenfe at live dot com
5 * Distributed under the Boost Software License,
6 * Version 1.0. (See accompanying file LICENSE_1_0.txt
7 * or copy at http://boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_SMART_PTR_DETAIL_ARRAY_COUNT_IMPL_HPP
10 #define BOOST_SMART_PTR_DETAIL_ARRAY_COUNT_IMPL_HPP
12 #include <boost/smart_ptr/detail/array_allocator.hpp>
13 #include <boost/smart_ptr/detail/sp_counted_impl.hpp>
17 template<class P, class A>
18 class sp_counted_impl_pda<P, ms_in_allocator_tag, A>
19 : public sp_counted_base {
20 typedef ms_in_allocator_tag D;
21 typedef sp_counted_impl_pda<P, D, A> Y;
23 sp_counted_impl_pda(P, D, const A& allocator_)
24 : allocator(allocator_) {
27 virtual void dispose() {
31 virtual void destroy() {
32 #if !defined(BOOST_NO_CXX11_ALLOCATOR)
33 typedef typename std::allocator_traits<A>::
34 template rebind_alloc<Y> YA;
35 typedef typename std::allocator_traits<A>::
36 template rebind_traits<Y> YT;
38 typedef typename A::template rebind<Y>::other YA;
41 #if !defined(BOOST_NO_CXX11_ALLOCATOR)
42 YT::destroy(a1, this);
43 YT::deallocate(a1, this, 1);
46 a1.deallocate(this, 1);
50 virtual void* get_deleter(const sp_typeinfo&) {
51 return &reinterpret_cast<char&>(allocator);
54 virtual void* get_untyped_deleter() {
55 return &reinterpret_cast<char&>(allocator);
59 sp_counted_impl_pda(const sp_counted_impl_pda&);
60 sp_counted_impl_pda& operator=(const sp_counted_impl_pda&);