mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-08-02 14:14:27 +02:00
Change traits for initializer list for g++
[SVN r81276]
This commit is contained in:
@@ -14,6 +14,9 @@
|
|||||||
#include <boost/smart_ptr/detail/array_deleter.hpp>
|
#include <boost/smart_ptr/detail/array_deleter.hpp>
|
||||||
#include <boost/smart_ptr/detail/array_traits.hpp>
|
#include <boost/smart_ptr/detail/array_traits.hpp>
|
||||||
#include <boost/smart_ptr/detail/sp_if_array.hpp>
|
#include <boost/smart_ptr/detail/sp_if_array.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||||
|
#include <initializer_list>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
template<typename T, typename A>
|
template<typename T, typename A>
|
||||||
@@ -72,7 +75,7 @@ namespace boost {
|
|||||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||||
template<typename T, typename A>
|
template<typename T, typename A>
|
||||||
inline typename detail::sp_if_array<T>::type
|
inline typename detail::sp_if_array<T>::type
|
||||||
allocate_shared(const A& allocator, typename detail::array_list<T>::type list) {
|
allocate_shared(const A& allocator, std::initializer_list<typename detail::array_inner<T>::type> list) {
|
||||||
typedef typename detail::array_inner<T>::type T1;
|
typedef typename detail::array_inner<T>::type T1;
|
||||||
typedef typename detail::array_base<T1>::type T2;
|
typedef typename detail::array_base<T1>::type T2;
|
||||||
typedef const T2 T3;
|
typedef const T2 T3;
|
||||||
@@ -92,7 +95,7 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
template<typename T, typename A>
|
template<typename T, typename A>
|
||||||
inline typename detail::sp_if_size_array<T>::type
|
inline typename detail::sp_if_size_array<T>::type
|
||||||
allocate_shared(const A& allocator, typename detail::array_list<T>::type list) {
|
allocate_shared(const A& allocator, std::initializer_list<typename detail::array_inner<T>::type> list) {
|
||||||
BOOST_ASSERT(list.size() == detail::array_size<T>::size);
|
BOOST_ASSERT(list.size() == detail::array_size<T>::size);
|
||||||
typedef typename detail::array_inner<T>::type T1;
|
typedef typename detail::array_inner<T>::type T1;
|
||||||
typedef typename detail::array_base<T1>::type T2;
|
typedef typename detail::array_base<T1>::type T2;
|
||||||
@@ -113,7 +116,7 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
template<typename T, typename A>
|
template<typename T, typename A>
|
||||||
inline typename detail::sp_if_array<T>::type
|
inline typename detail::sp_if_array<T>::type
|
||||||
allocate_shared(const A& allocator, std::size_t size, typename detail::inner_list<T>::type list) {
|
allocate_shared(const A& allocator, std::size_t size, std::initializer_list<typename detail::arrays_inner<T>::type> list) {
|
||||||
typedef typename detail::array_inner<T>::type T1;
|
typedef typename detail::array_inner<T>::type T1;
|
||||||
typedef typename detail::array_base<T1>::type T2;
|
typedef typename detail::array_base<T1>::type T2;
|
||||||
typedef const T2 T3;
|
typedef const T2 T3;
|
||||||
|
@@ -10,9 +10,6 @@
|
|||||||
#define BOOST_SMART_PTR_DETAIL_ARRAY_TRAITS_HPP
|
#define BOOST_SMART_PTR_DETAIL_ARRAY_TRAITS_HPP
|
||||||
|
|
||||||
#include <boost/type_traits/remove_cv.hpp>
|
#include <boost/type_traits/remove_cv.hpp>
|
||||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
|
||||||
#include <initializer_list>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
@@ -56,26 +53,13 @@ namespace boost {
|
|||||||
struct array_inner<T[N]> {
|
struct array_inner<T[N]> {
|
||||||
typedef T type;
|
typedef T type;
|
||||||
};
|
};
|
||||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct array_list {
|
struct arrays_inner {
|
||||||
};
|
|
||||||
template<typename T>
|
|
||||||
struct array_list<T[]> {
|
|
||||||
typedef std::initializer_list<T> type;
|
|
||||||
};
|
};
|
||||||
template<typename T, size_t N>
|
template<typename T, size_t N>
|
||||||
struct array_list<T[N]> {
|
struct arrays_inner<T[][N]> {
|
||||||
typedef std::initializer_list<T> type;
|
typedef T type;
|
||||||
};
|
};
|
||||||
template<typename T>
|
|
||||||
struct inner_list {
|
|
||||||
};
|
|
||||||
template<typename T, size_t N>
|
|
||||||
struct inner_list<T[][N]> {
|
|
||||||
typedef std::initializer_list<T> type;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,6 +14,9 @@
|
|||||||
#include <boost/smart_ptr/detail/array_traits.hpp>
|
#include <boost/smart_ptr/detail/array_traits.hpp>
|
||||||
#include <boost/smart_ptr/detail/make_array_helper.hpp>
|
#include <boost/smart_ptr/detail/make_array_helper.hpp>
|
||||||
#include <boost/smart_ptr/detail/sp_if_array.hpp>
|
#include <boost/smart_ptr/detail/sp_if_array.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||||
|
#include <initializer_list>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@@ -72,7 +75,7 @@ namespace boost {
|
|||||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline typename detail::sp_if_array<T>::type
|
inline typename detail::sp_if_array<T>::type
|
||||||
make_shared(typename detail::array_list<T>::type list) {
|
make_shared(std::initializer_list<typename detail::array_inner<T>::type> list) {
|
||||||
typedef typename detail::array_inner<T>::type T1;
|
typedef typename detail::array_inner<T>::type T1;
|
||||||
typedef typename detail::array_base<T1>::type T2;
|
typedef typename detail::array_base<T1>::type T2;
|
||||||
typedef const T2 T3;
|
typedef const T2 T3;
|
||||||
@@ -92,7 +95,7 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline typename detail::sp_if_size_array<T>::type
|
inline typename detail::sp_if_size_array<T>::type
|
||||||
make_shared(typename detail::array_list<T>::type list) {
|
make_shared(std::initializer_list<typename detail::array_inner<T>::type> list) {
|
||||||
BOOST_ASSERT(list.size() == detail::array_size<T>::size);
|
BOOST_ASSERT(list.size() == detail::array_size<T>::size);
|
||||||
typedef typename detail::array_inner<T>::type T1;
|
typedef typename detail::array_inner<T>::type T1;
|
||||||
typedef typename detail::array_base<T1>::type T2;
|
typedef typename detail::array_base<T1>::type T2;
|
||||||
@@ -113,7 +116,7 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline typename detail::sp_if_array<T>::type
|
inline typename detail::sp_if_array<T>::type
|
||||||
make_shared(std::size_t size, typename detail::inner_list<T>::type list) {
|
make_shared(std::size_t size, std::initializer_list<typename detail::arrays_inner<T>::type> list) {
|
||||||
typedef typename detail::array_inner<T>::type T1;
|
typedef typename detail::array_inner<T>::type T1;
|
||||||
typedef typename detail::array_base<T1>::type T2;
|
typedef typename detail::array_base<T1>::type T2;
|
||||||
typedef const T2 T3;
|
typedef const T2 T3;
|
||||||
|
Reference in New Issue
Block a user