1/*
2Copyright 2012-2017 Glen Joseph Fernandes
3(glenjofe@gmail.com)
4
5Distributed under the Boost Software License, Version 1.0.
6(http://www.boost.org/LICENSE_1_0.txt)
7*/
8#ifndef BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP
9#define BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP
10
11#include <boost/smart_ptr/allocate_shared_array.hpp>
12
13namespace boost {
14
15template<class T>
16inline typename detail::sp_if_size_array<T>::type
17make_shared()
18{
19 return boost::allocate_shared<T>(std::allocator<typename
20 detail::sp_array_scalar<T>::type>());
21}
22
23template<class T>
24inline typename detail::sp_if_size_array<T>::type
25make_shared(const typename detail::sp_array_element<T>::type& value)
26{
27 return boost::allocate_shared<T>(std::allocator<typename
28 detail::sp_array_scalar<T>::type>(), value);
29}
30
31template<class T>
32inline typename detail::sp_if_array<T>::type
33make_shared(std::size_t size)
34{
35 return boost::allocate_shared<T>(std::allocator<typename
36 detail::sp_array_scalar<T>::type>(), size);
37}
38
39template<class T>
40inline typename detail::sp_if_array<T>::type
41make_shared(std::size_t size,
42 const typename detail::sp_array_element<T>::type& value)
43{
44 return boost::allocate_shared<T>(std::allocator<typename
45 detail::sp_array_scalar<T>::type>(), size, value);
46}
47
48template<class T>
49inline typename detail::sp_if_size_array<T>::type
50make_shared_noinit()
51{
52 return allocate_shared_noinit<T>(std::allocator<typename
53 detail::sp_array_scalar<T>::type>());
54}
55
56template<class T>
57inline typename detail::sp_if_array<T>::type
58make_shared_noinit(std::size_t size)
59{
60 return allocate_shared_noinit<T>(std::allocator<typename
61 detail::sp_array_scalar<T>::type>(), size);
62}
63
64} /* boost */
65
66#endif
67