summaryrefslogtreecommitdiff
path: root/boost/type_traits/has_trivial_constructor.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/type_traits/has_trivial_constructor.hpp')
-rw-r--r--boost/type_traits/has_trivial_constructor.hpp56
1 files changed, 31 insertions, 25 deletions
diff --git a/boost/type_traits/has_trivial_constructor.hpp b/boost/type_traits/has_trivial_constructor.hpp
index 30dbdd8f93..06c137d1de 100644
--- a/boost/type_traits/has_trivial_constructor.hpp
+++ b/boost/type_traits/has_trivial_constructor.hpp
@@ -9,43 +9,49 @@
#ifndef BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED
#define BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED
-#include <boost/type_traits/config.hpp>
#include <boost/type_traits/intrinsics.hpp>
#include <boost/type_traits/is_pod.hpp>
-#include <boost/type_traits/detail/ice_or.hpp>
+#include <boost/type_traits/is_default_constructible.hpp>
-// should be the last #include
-#include <boost/type_traits/detail/bool_trait_def.hpp>
+#ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR
+#ifdef BOOST_HAS_SGI_TYPE_TRAITS
+#include <boost/type_traits/is_same.hpp>
+#elif defined(__GNUC__) || defined(__SUNPRO_CC)
+#include <boost/type_traits/is_volatile.hpp>
+#ifdef BOOST_INTEL
+#include <boost/type_traits/is_pod.hpp>
+#endif
+#endif
+#endif
-namespace boost {
-namespace detail {
+#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || defined(BOOST_CLANG) || (defined(__SUNPRO_CC) && defined(BOOST_HAS_TRIVIAL_CONSTRUCTOR))
+#include <boost/type_traits/is_default_constructible.hpp>
+#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX && is_default_constructible<T>::value
+#else
+//
+// Mot all compilers, particularly older GCC versions can handle the fix above.
+#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX
+#endif
+
+namespace boost {
-template <typename T>
-struct has_trivial_ctor_impl
-{
+template <typename T> struct has_trivial_constructor
#ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR
- BOOST_STATIC_CONSTANT(bool, value =
- (::boost::type_traits::ice_or<
- ::boost::is_pod<T>::value,
- BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)
- >::value));
+ : public integral_constant <bool, ((::boost::is_pod<T>::value || BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)) BOOST_TT_TRIVIAL_CONSTRUCT_FIX)>{};
#else
- BOOST_STATIC_CONSTANT(bool, value =
- (::boost::type_traits::ice_or<
- ::boost::is_pod<T>::value,
- false
- >::value));
+ : public integral_constant <bool, ::boost::is_pod<T>::value>{};
#endif
-};
-} // namespace detail
+template <> struct has_trivial_constructor<void> : public boost::false_type{};
+template <> struct has_trivial_constructor<void const> : public boost::false_type{};
+template <> struct has_trivial_constructor<void const volatile> : public boost::false_type{};
+template <> struct has_trivial_constructor<void volatile> : public boost::false_type{};
-BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_constructor,T,::boost::detail::has_trivial_ctor_impl<T>::value)
-BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_default_constructor,T,::boost::detail::has_trivial_ctor_impl<T>::value)
+template <class T> struct has_trivial_default_constructor : public has_trivial_constructor<T> {};
-} // namespace boost
+#undef BOOST_TT_TRIVIAL_CONSTRUCT_FIX
-#include <boost/type_traits/detail/bool_trait_undef.hpp>
+} // namespace boost
#endif // BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED