Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:08:51

0001 /*
0002 Copyright 2012-2019 Glen Joseph Fernandes
0003 (glenjofe@gmail.com)
0004 
0005 Distributed under the Boost Software License, Version 1.0.
0006 (http://www.boost.org/LICENSE_1_0.txt)
0007 */
0008 #ifndef BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP
0009 #define BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP
0010 
0011 #include <boost/core/default_allocator.hpp>
0012 #include <boost/smart_ptr/allocate_shared_array.hpp>
0013 #include <boost/smart_ptr/detail/sp_type_traits.hpp>
0014 #include <type_traits>
0015 
0016 namespace boost {
0017 
0018 template<class T>
0019 inline typename std::enable_if<detail::sp_is_bounded_array<T>::value, shared_ptr<T> >::type
0020 make_shared()
0021 {
0022     return boost::allocate_shared<T>(boost::default_allocator<typename
0023         detail::sp_array_element<T>::type>());
0024 }
0025 
0026 template<class T>
0027 inline typename std::enable_if<detail::sp_is_bounded_array<T>::value, shared_ptr<T> >::type
0028 make_shared(const typename std::remove_extent<T>::type& value)
0029 {
0030     return boost::allocate_shared<T>(boost::default_allocator<typename
0031         detail::sp_array_element<T>::type>(), value);
0032 }
0033 
0034 template<class T>
0035 inline typename std::enable_if<detail::sp_is_unbounded_array<T>::value, shared_ptr<T> >::type
0036 make_shared(std::size_t size)
0037 {
0038     return boost::allocate_shared<T>(boost::default_allocator<typename
0039         detail::sp_array_element<T>::type>(), size);
0040 }
0041 
0042 template<class T>
0043 inline typename std::enable_if<detail::sp_is_unbounded_array<T>::value, shared_ptr<T> >::type
0044 make_shared(std::size_t size, const typename std::remove_extent<T>::type& value)
0045 {
0046     return boost::allocate_shared<T>(boost::default_allocator<typename
0047         detail::sp_array_element<T>::type>(), size, value);
0048 }
0049 
0050 template<class T>
0051 inline typename std::enable_if<detail::sp_is_bounded_array<T>::value, shared_ptr<T> >::type
0052 make_shared_noinit()
0053 {
0054     return boost::allocate_shared_noinit<T>(boost::default_allocator<typename
0055         detail::sp_array_element<T>::type>());
0056 }
0057 
0058 template<class T>
0059 inline typename std::enable_if<detail::sp_is_unbounded_array<T>::value, shared_ptr<T> >::type
0060 make_shared_noinit(std::size_t size)
0061 {
0062     return boost::allocate_shared_noinit<T>(boost::default_allocator<typename
0063         detail::sp_array_element<T>::type>(), size);
0064 }
0065 
0066 } /* boost */
0067 
0068 #endif