1
2// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
3// Use, modification and distribution are subject to the Boost Software License,
4// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt).
6//
7// See http://www.boost.org/libs/type_traits for most recent version including documentation.
8
9#ifndef BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED
10#define BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED
11
12#include <boost/type_traits/detail/config.hpp>
13#include <boost/type_traits/intrinsics.hpp>
14#include <boost/type_traits/integral_constant.hpp>
15
16#if !defined(BOOST_HAS_TRIVIAL_ASSIGN) || defined(BOOST_MSVC) || defined(__GNUC__) || defined(BOOST_INTEL) || defined(__SUNPRO_CC) || defined(__clang)
17#include <boost/type_traits/is_pod.hpp>
18#include <boost/type_traits/is_const.hpp>
19#include <boost/type_traits/is_volatile.hpp>
20#include <boost/type_traits/is_assignable.hpp>
21#endif
22
23namespace boost {
24
25 template <typename T>
26 struct has_trivial_assign : public integral_constant < bool,
27#ifdef BOOST_HAS_TRIVIAL_ASSIGN
28 BOOST_HAS_TRIVIAL_ASSIGN(T)
29#else
30 ::boost::is_pod<T>::value && !::boost::is_const<T>::value && !::boost::is_volatile<T>::value
31#endif
32 > {};
33
34 template<> struct has_trivial_assign<void> : public false_type{};
35#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
36 template<> struct has_trivial_assign<void const> : public false_type{};
37 template<> struct has_trivial_assign<void const volatile> : public false_type{};
38 template<> struct has_trivial_assign<void volatile> : public false_type{};
39#endif
40 template <class T> struct has_trivial_assign<T volatile> : public false_type{};
41 template <class T> struct has_trivial_assign<T&> : public false_type{};
42#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
43 template <class T> struct has_trivial_assign<T&&> : public false_type{};
44#endif
45 // Arrays are not explictly assignable:
46 template <typename T, std::size_t N> struct has_trivial_assign<T[N]> : public false_type{};
47 template <typename T> struct has_trivial_assign<T[]> : public false_type{};
48
49} // namespace boost
50
51#endif // BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED
52