File indexing completed on 2025-01-18 09:53:10
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_TT_IS_ASSIGNABLE_HPP_INCLUDED
0010 #define BOOST_TT_IS_ASSIGNABLE_HPP_INCLUDED
0011
0012 #include <cstddef> // size_t
0013 #include <boost/type_traits/integral_constant.hpp>
0014 #include <boost/detail/workaround.hpp>
0015 #include <boost/type_traits/is_complete.hpp>
0016 #include <boost/static_assert.hpp>
0017
0018 namespace boost{
0019
0020 template <class T, class U = T> struct is_assignable;
0021
0022 }
0023
0024 #if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
0025
0026 #include <boost/type_traits/detail/yes_no_type.hpp>
0027 #include <boost/type_traits/declval.hpp>
0028
0029 namespace boost{
0030
0031 namespace detail{
0032
0033 struct is_assignable_imp
0034 {
0035 template<typename T, typename U, typename = decltype(boost::declval<T>() = boost::declval<U>())>
0036 static boost::type_traits::yes_type test(int);
0037
0038 template<typename, typename>
0039 static boost::type_traits::no_type test(...);
0040 };
0041
0042 }
0043
0044 template <class T, class U> struct is_assignable : public integral_constant<bool, sizeof(detail::is_assignable_imp::test<T, U>(0)) == sizeof(boost::type_traits::yes_type)>
0045 {
0046 BOOST_STATIC_ASSERT_MSG(boost::is_complete<T>::value, "Arguments to is_assignable must be complete types");
0047 };
0048 template <class T, std::size_t N, class U> struct is_assignable<T[N], U> : public is_assignable<T, U>{};
0049 template <class T, std::size_t N, class U> struct is_assignable<T(&)[N], U> : public is_assignable<T&, U>{};
0050 template <class T, class U> struct is_assignable<T[], U> : public is_assignable<T, U>{};
0051 template <class T, class U> struct is_assignable<T(&)[], U> : public is_assignable<T&, U>{};
0052 template <class U> struct is_assignable<void, U> : public integral_constant<bool, false>{};
0053 template <class U> struct is_assignable<void const, U> : public integral_constant<bool, false>{};
0054 template <class U> struct is_assignable<void volatile, U> : public integral_constant<bool, false>{};
0055 template <class U> struct is_assignable<void const volatile, U> : public integral_constant<bool, false>{};
0056
0057 #else
0058
0059 #include <boost/type_traits/has_trivial_assign.hpp>
0060 #include <boost/type_traits/remove_reference.hpp>
0061
0062 namespace boost{
0063
0064
0065 template <class T, class U> struct is_assignable : public integral_constant<bool, false>
0066 {
0067 BOOST_STATIC_ASSERT_MSG(boost::is_complete<T>::value, "Arguments to is_assignable must be complete types");
0068 };
0069 template <class T, class U> struct is_assignable<T&, U> : public integral_constant<bool, is_pod<T>::value && is_pod<typename remove_reference<U>::type>::value>{};
0070 template <class T, class U> struct is_assignable<const T&, U> : public integral_constant<bool, false>{};
0071 template <class U> struct is_assignable<void, U> : public integral_constant<bool, false>{};
0072 template <class U> struct is_assignable<void const, U> : public integral_constant<bool, false>{};
0073 template <class U> struct is_assignable<void volatile, U> : public integral_constant<bool, false>{};
0074 template <class U> struct is_assignable<void const volatile, U> : public integral_constant<bool, false>{};
0075
0076
0077
0078
0079
0080
0081 #endif
0082
0083 }
0084
0085 #endif