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 <cstddef> // size_t
13#include <boost/type_traits/detail/config.hpp>
14#include <boost/type_traits/intrinsics.hpp>
15#include <boost/type_traits/integral_constant.hpp>
16
17#if !defined(BOOST_HAS_TRIVIAL_ASSIGN) || defined(BOOST_MSVC) || defined(__GNUC__) || defined(BOOST_INTEL) || defined(__SUNPRO_CC) || defined(__clang__)
18#include <boost/type_traits/is_pod.hpp>
19#include <boost/type_traits/is_const.hpp>
20#include <boost/type_traits/is_volatile.hpp>
21#include <boost/type_traits/is_assignable.hpp>
22#endif
23
24namespace boost {
25
26 template <typename T>
27 struct has_trivial_assign : public integral_constant < bool,
28#ifdef BOOST_HAS_TRIVIAL_ASSIGN
29 BOOST_HAS_TRIVIAL_ASSIGN(T)
30#else
31 ::boost::is_pod<T>::value && !::boost::is_const<T>::value && !::boost::is_volatile<T>::value
32#endif
33 > {};
34
35 template<> struct has_trivial_assign<void> : public false_type{};
36#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
37 template<> struct has_trivial_assign<void const> : public false_type{};
38 template<> struct has_trivial_assign<void const volatile> : public false_type{};
39 template<> struct has_trivial_assign<void volatile> : public false_type{};
40#endif
41 template <class T> struct has_trivial_assign<T volatile> : public false_type{};
42 template <class T> struct has_trivial_assign<T&> : public false_type{};
43#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
44 template <class T> struct has_trivial_assign<T&&> : public false_type{};
45#endif
46 // Arrays are not explictly assignable:
47 template <typename T, std::size_t N> struct has_trivial_assign<T[N]> : public false_type{};
48 template <typename T> struct has_trivial_assign<T[]> : public false_type{};
49
50} // namespace boost
51
52#endif // BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED
53