2 Copyright 2017 Peter Dimov
3 Copyright 2017-2019 Glen Joseph Fernandes
6 Distributed under the Boost Software License, Version 1.0.
7 (http://www.boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_SMART_PTR_MAKE_LOCAL_SHARED_ARRAY_HPP
10 #define BOOST_SMART_PTR_MAKE_LOCAL_SHARED_ARRAY_HPP
12 #include <boost/core/default_allocator.hpp>
13 #include <boost/smart_ptr/allocate_local_shared_array.hpp>
18 inline typename enable_if_<is_bounded_array<T>::value,
19 local_shared_ptr<T> >::type
22 return boost::allocate_local_shared<T>(boost::default_allocator<typename
23 detail::sp_array_element<T>::type>());
27 inline typename enable_if_<is_bounded_array<T>::value,
28 local_shared_ptr<T> >::type
29 make_local_shared(const typename remove_extent<T>::type& value)
31 return boost::allocate_local_shared<T>(boost::default_allocator<typename
32 detail::sp_array_element<T>::type>(), value);
36 inline typename enable_if_<is_unbounded_array<T>::value,
37 local_shared_ptr<T> >::type
38 make_local_shared(std::size_t size)
40 return boost::allocate_local_shared<T>(boost::default_allocator<typename
41 detail::sp_array_element<T>::type>(), size);
45 inline typename enable_if_<is_unbounded_array<T>::value,
46 local_shared_ptr<T> >::type
47 make_local_shared(std::size_t size,
48 const typename remove_extent<T>::type& value)
50 return boost::allocate_local_shared<T>(boost::default_allocator<typename
51 detail::sp_array_element<T>::type>(), size, value);
55 inline typename enable_if_<is_bounded_array<T>::value,
56 local_shared_ptr<T> >::type
57 make_local_shared_noinit()
59 return boost::allocate_local_shared_noinit<T>(boost::
60 default_allocator<typename detail::sp_array_element<T>::type>());
64 inline typename enable_if_<is_unbounded_array<T>::value,
65 local_shared_ptr<T> >::type
66 make_local_shared_noinit(std::size_t size)
68 return boost::allocate_local_shared_noinit<T>(boost::
69 default_allocator<typename detail::sp_array_element<T>::type>(), size);