Fix has_trivial_copy so that non-copyable types are never trivially copyable! Also fix clang to detect trivially copyable array types.

This commit is contained in:
jzmaddock committed 2014-08-23 12:20:26 +01:00
1 parent c0a2a3c012
commit df74811a4c
2 files changed
+35

No files matched your search

@@ -17,6 +17,10 @@
#include <boost/type_traits/detail/ice_or.hpp>
#include <boost/type_traits/detail/ice_not.hpp>
#ifdef __clang__
#include <boost/type_traits/is_copy_constructible.hpp>
#endif
// should be the last #include
#include <boost/type_traits/detail/bool_trait_def.hpp>
@@ -28,7 +32,11 @@ template <typename T>
struct has_trivial_copy_impl
{
#ifdef BOOST_HAS_TRIVIAL_COPY
# ifdef __clang__
BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T) && boost::is_copy_constructible<T>::value);
# else
BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T));
# endif
#else
BOOST_STATIC_CONSTANT(bool, value =
(::boost::type_traits::ice_and<
@@ -38,6 +46,16 @@ struct has_trivial_copy_impl
#endif
};
#ifdef __clang__
template <typename T, std::size_t N>
struct has_trivial_copy_impl<T[N]>
{
static const bool value = has_trivial_copy_impl<T>::value;
};
#endif
} // namespace detail
BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy,T,::boost::detail::has_trivial_copy_impl<T>::value)