is_default_constructible.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef BOOST_SERIALIZATION_DETAIL_IS_DEFAULT_CONSTRUCTIBLE_HPP
  2. #define BOOST_SERIALIZATION_DETAIL_IS_DEFAULT_CONSTRUCTIBLE_HPP
  3. // MS compatible compilers support #pragma once
  4. #if defined(_MSC_VER)
  5. # pragma once
  6. #endif
  7. /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
  8. // is_default_constructible.hpp: serialization for loading stl collections
  9. //
  10. // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
  11. // Use, modification and distribution is subject to the Boost Software
  12. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  13. // http://www.boost.org/LICENSE_1_0.txt)
  14. // See http://www.boost.org for updates, documentation, and revision history.
  15. #include <boost/config.hpp>
  16. #if ! defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
  17. #include <type_traits>
  18. namespace boost{
  19. namespace serialization {
  20. namespace detail {
  21. template<typename T>
  22. struct is_default_constructible : public std::is_default_constructible<T> {};
  23. } // detail
  24. } // serialization
  25. } // boost
  26. #else
  27. // we don't have standard library support for is_default_constructible
  28. // so we fake it by using boost::has_trivial_construtor. But this is not
  29. // actually correct because it's possible that a default constructor
  30. // to be non trivial. So when using this, make sure you're not using your
  31. // own definition of of T() but are using the actual default one!
  32. #include <boost/type_traits/has_trivial_constructor.hpp>
  33. namespace boost{
  34. namespace serialization {
  35. namespace detail {
  36. template<typename T>
  37. struct is_default_constructible : public boost::has_trivial_constructor<T> {};
  38. } // detail
  39. } // serialization
  40. } // boost
  41. #endif
  42. #endif // BOOST_SERIALIZATION_DETAIL_IS_DEFAULT_CONSTRUCTIBLE_HPP