is_list_constructible.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef BOOST_TYPE_TRAITS_IS_LIST_CONSTRUCTIBLE_HPP_INCLUDED
  2. #define BOOST_TYPE_TRAITS_IS_LIST_CONSTRUCTIBLE_HPP_INCLUDED
  3. // Copyright 2017 Peter Dimov
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt
  8. #include <boost/config.hpp>
  9. #include <boost/config/workaround.hpp>
  10. #include <boost/type_traits/integral_constant.hpp>
  11. #include <boost/type_traits/declval.hpp>
  12. #include <boost/type_traits/is_complete.hpp>
  13. #include <boost/static_assert.hpp>
  14. namespace boost
  15. {
  16. #if defined(BOOST_NO_SFINAE_EXPR) || defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_NO_CXX11_DECLTYPE) \
  17. || defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) || defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS)\
  18. || BOOST_WORKAROUND(BOOST_GCC, < 40700)
  19. template<class T, class = void, class = void, class = void, class = void, class = void, class = void> struct is_list_constructible: false_type
  20. {
  21. BOOST_STATIC_ASSERT_MSG(boost::is_complete<T>::value, "Arguments to is_list_constructible must be complete types");
  22. };
  23. #else
  24. namespace type_traits_detail
  25. {
  26. template<class T, class... A, class = decltype( T{declval<A>()...} )> true_type is_list_constructible_impl( int );
  27. template<class T, class... A> false_type is_list_constructible_impl( ... );
  28. } // namespace type_traits_detail
  29. template<class T, class... A> struct is_list_constructible: decltype( type_traits_detail::is_list_constructible_impl<T, A...>(0) )
  30. {
  31. BOOST_STATIC_ASSERT_MSG(boost::is_complete<T>::value, "Arguments to is_list_constructible must be complete types");
  32. };
  33. #endif
  34. } // namespace boost
  35. #endif // #ifndef BOOST_TYPE_TRAITS_IS_LIST_CONSTRUCTIBLE_HPP_INCLUDED