diff options
Diffstat (limited to 'boost/type_traits/is_default_constructible.hpp')
-rw-r--r-- | boost/type_traits/is_default_constructible.hpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/boost/type_traits/is_default_constructible.hpp b/boost/type_traits/is_default_constructible.hpp index fa5d76a22d..9a4a0a78b2 100644 --- a/boost/type_traits/is_default_constructible.hpp +++ b/boost/type_traits/is_default_constructible.hpp @@ -12,10 +12,15 @@ #include <cstddef> // size_t #include <boost/type_traits/integral_constant.hpp> #include <boost/detail/workaround.hpp> +#include <boost/type_traits/is_complete.hpp> +#include <boost/static_assert.hpp> #if BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700) #include <boost/type_traits/is_abstract.hpp> #endif +#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ <= 5)) || (defined(BOOST_MSVC) && (BOOST_MSVC == 1800)) +#include <utility> // std::pair +#endif #if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500) @@ -48,13 +53,22 @@ namespace boost{ } #if BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700) - template <class T> struct is_default_constructible : public integral_constant<bool, detail::is_default_constructible_abstract_filter<T, boost::is_abstract<T>::value>::value>{}; + template <class T> struct is_default_constructible : public integral_constant<bool, detail::is_default_constructible_abstract_filter<T, boost::is_abstract<T>::value>::value> + { + BOOST_STATIC_ASSERT_MSG(boost::is_complete<T>::value, "Arguments to is_default_constructible must be complete types"); + }; #else - template <class T> struct is_default_constructible : public integral_constant<bool, sizeof(detail::is_default_constructible_imp::test<T>(0)) == sizeof(boost::type_traits::yes_type)>{}; + template <class T> struct is_default_constructible : public integral_constant<bool, sizeof(detail::is_default_constructible_imp::test<T>(0)) == sizeof(boost::type_traits::yes_type)> + { + BOOST_STATIC_ASSERT_MSG(boost::is_complete<T>::value, "Arguments to is_default_constructible must be complete types"); + }; #endif template <class T, std::size_t N> struct is_default_constructible<T[N]> : public is_default_constructible<T>{}; template <class T> struct is_default_constructible<T[]> : public is_default_constructible<T>{}; template <class T> struct is_default_constructible<T&> : public integral_constant<bool, false>{}; +#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ <= 5))|| (defined(BOOST_MSVC) && (BOOST_MSVC == 1800)) + template <class T, class U> struct is_default_constructible<std::pair<T,U> > : public integral_constant<bool, is_default_constructible<T>::value && is_default_constructible<U>::value>{}; +#endif #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template <class T> struct is_default_constructible<T&&> : public integral_constant<bool, false>{}; #endif |