diff --git a/doc/copy_cv_ref.qbk b/doc/copy_cv_ref.qbk new file mode 100644 index 0000000..95256ff --- /dev/null +++ b/doc/copy_cv_ref.qbk @@ -0,0 +1,65 @@ +[/ +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, +Version 1.0. (See accompanying file LICENSE_1_0.txt +or copy at http://www.boost.org/LICENSE_1_0.txt). +] + +[section:copy_cv_ref copy_cv_ref] + + template + struct copy_cv_ref + { + typedef __below type; + }; + + template + using copy_cv_ref_t = typename copy_cv_ref::type; + +__type [^T /cvref/], where /cvref/ are the cvref-qualifiers of `U`. + +__header `#include ` or +`#include >` + +[table Examples + +[[Expression] [Result Type]] + +[[`copy_cv_ref::type`][`const int`]] + +[[`copy_cv_ref::type`][`volatile int`]] + +[[`copy_cv_ref::type`][`const volatile int`]] + +[[`copy_cv_ref::type`][`int&`]] + +[[`copy_cv_ref::type`][`const int&`]] + +[[`copy_cv_ref::type`][`volatile int&`]] + +[[`copy_cv_ref::type`][`const volatile int&`]] + +[[`copy_cv_ref::type`][`int&&`]] + +[[`copy_cv_ref::type`][`const int&&`]] + +[[`copy_cv_ref::type`][`volatile int&&`]] + +[[`copy_cv_ref::type`][`const volatile int&&`]] + +[[`copy_cv_ref::type`][`int&`]] + +[[`copy_cv_ref::type`][`int&`]] + +[[`copy_cv_ref::type`][`int&`]] + +[[`copy_cv_ref::type`][`int&`]] + +] + +[all_compilers] The type alias `copy_cv_ref_t` is only available if the compiler +supports template aliases. + +[endsect] diff --git a/doc/copy_reference.qbk b/doc/copy_reference.qbk new file mode 100644 index 0000000..9a97e03 --- /dev/null +++ b/doc/copy_reference.qbk @@ -0,0 +1,53 @@ +[/ +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, +Version 1.0. (See accompanying file LICENSE_1_0.txt +or copy at http://www.boost.org/LICENSE_1_0.txt). +] + +[section:copy_reference copy_reference_] + + template + struct copy_reference + { + typedef __below type; + }; + + template + using copy_reference_t = typename copy_reference::type; + +__type [^T /ref/], where /ref/ are the ref-qualifiers of `U`. + +__header `#include ` or +`#include >` + +[table Examples + +[[Expression] [Result Type]] + +[[`copy_reference::type`][`int`]] + +[[`copy_reference::type`] [`int&`]] + +[[`copy_reference::type`] [`int&&`]] + +[[`copy_reference::type`] [`int&`]] + +[[`copy_reference::type`] [`int&`]] + +[[`copy_reference::type`] [`int&`]] + +[[`copy_reference::type`] [`int&&`]] + +[[`copy_reference::type`] [`int&`]] + +[[`copy_reference::type`] [`int&&`]] + +] + +[all_compilers] The type alias `copy_reference_t` is only available if the compiler +supports template aliases. + +[endsect] diff --git a/doc/history.qbk b/doc/history.qbk index 54c3d09..6d0def8 100644 --- a/doc/history.qbk +++ b/doc/history.qbk @@ -9,7 +9,7 @@ [h4 Boost-1.70.0] -* Added new traits __is_bounded_array, __is_unbounded_array. +* Added new traits __is_bounded_array, __is_unbounded_array, __copy_reference, __copy_cv_ref. [h4 Boost-1.68.0] diff --git a/doc/type_traits.qbk b/doc/type_traits.qbk index 8d3aaed..ce3f1d4 100644 --- a/doc/type_traits.qbk +++ b/doc/type_traits.qbk @@ -146,6 +146,8 @@ [def __is_complex [link boost_typetraits.reference.is_complex is_complex]] [def __copy_cv [link boost_typetraits.reference.copy_cv copy_cv]] +[def __copy_cv_ref [link boost_typetraits.reference.copy_cv_ref copy_cv_ref]] +[def __copy_reference [link boost_typetraits.reference.copy_reference copy_reference]] [def __type_identity [link boost_typetraits.reference.type_identity type_identity]] [def __declval [link boost_typetraits.reference.declval declval]] @@ -307,6 +309,8 @@ that is the result of the transformation. [include conditional.qbk] [include common_type.qbk] [include copy_cv.qbk] +[include copy_cv_ref.qbk] +[include copy_reference.qbk] [include decay.qbk] [include declval.qbk] [include detected.qbk] diff --git a/include/boost/type_traits.hpp b/include/boost/type_traits.hpp index a767e41..d61d5d7 100644 --- a/include/boost/type_traits.hpp +++ b/include/boost/type_traits.hpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/include/boost/type_traits/copy_cv_ref.hpp b/include/boost/type_traits/copy_cv_ref.hpp new file mode 100644 index 0000000..59cbc66 --- /dev/null +++ b/include/boost/type_traits/copy_cv_ref.hpp @@ -0,0 +1,31 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, +Version 1.0. (See accompanying file LICENSE_1_0.txt +or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_TT_COPY_CV_REF_HPP_INCLUDED +#define BOOST_TT_COPY_CV_REF_HPP_INCLUDED + +#include +#include +#include + +namespace boost { + +template +struct copy_cv_ref { + typedef typename copy_reference::type >::type, U>::type type; +}; + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) +template +using copy_cv_ref_t = typename copy_cv_ref::type; +#endif + +} /* boost */ + +#endif diff --git a/include/boost/type_traits/copy_reference.hpp b/include/boost/type_traits/copy_reference.hpp new file mode 100644 index 0000000..0056681 --- /dev/null +++ b/include/boost/type_traits/copy_reference.hpp @@ -0,0 +1,35 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, +Version 1.0. (See accompanying file LICENSE_1_0.txt +or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_TT_COPY_REFERENCE_HPP_INCLUDED +#define BOOST_TT_COPY_REFERENCE_HPP_INCLUDED + +#include +#include +#include +#include +#include + +namespace boost { + +template +struct copy_reference { + typedef typename conditional::value, + typename add_rvalue_reference::type, + typename conditional::value, + typename add_lvalue_reference::type, T>::type>::type type; +}; + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) +template +using copy_reference_t = typename copy_reference::type; +#endif + +} /* boost */ + +#endif diff --git a/include/boost/type_traits/detail/has_binary_operator.hpp b/include/boost/type_traits/detail/has_binary_operator.hpp index ec6e52e..7e74705 100644 --- a/include/boost/type_traits/detail/has_binary_operator.hpp +++ b/include/boost/type_traits/detail/has_binary_operator.hpp @@ -47,25 +47,25 @@ namespace boost struct dont_care; - template > + template struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp) : public boost::false_type {}; template - struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp)::type>() BOOST_TT_TRAIT_OP std::declval::type>())> > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp)::type>() BOOST_TT_TRAIT_OP std::declval::type>())>::type> : public boost::integral_constant::type>() BOOST_TT_TRAIT_OP std::declval::type>()), Ret>::value> {}; - template > + template struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp) : public boost::false_type {}; template - struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp)::type>() BOOST_TT_TRAIT_OP std::declval::type>())> > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp)::type>() BOOST_TT_TRAIT_OP std::declval::type>())>::type> : public boost::integral_constant::type>() BOOST_TT_TRAIT_OP std::declval::type>())>::value> {}; - template > + template struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp) : public boost::false_type {}; template - struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp)::type>() BOOST_TT_TRAIT_OP std::declval::type>())> > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp)::type>() BOOST_TT_TRAIT_OP std::declval::type>())>::type> : public boost::true_type {}; } diff --git a/include/boost/type_traits/detail/has_postfix_operator.hpp b/include/boost/type_traits/detail/has_postfix_operator.hpp index 1812416..d900acd 100644 --- a/include/boost/type_traits/detail/has_postfix_operator.hpp +++ b/include/boost/type_traits/detail/has_postfix_operator.hpp @@ -25,25 +25,25 @@ namespace boost struct dont_care; - template > + template struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp) : public boost::false_type {}; template - struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp)::type>() BOOST_TT_TRAIT_OP) > > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp)::type>() BOOST_TT_TRAIT_OP) >::type> : public boost::integral_constant::type>() BOOST_TT_TRAIT_OP), Ret>::value> {}; - template > + template struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp) : public boost::false_type {}; template - struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp)::type>()BOOST_TT_TRAIT_OP)> > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp)::type>()BOOST_TT_TRAIT_OP)>::type> : public boost::integral_constant::type>() BOOST_TT_TRAIT_OP)>::value> {}; - template > + template struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp) : public boost::false_type {}; template - struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp)::type>() BOOST_TT_TRAIT_OP)> > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp)::type>() BOOST_TT_TRAIT_OP)>::type> : public boost::true_type {}; } diff --git a/include/boost/type_traits/detail/has_prefix_operator.hpp b/include/boost/type_traits/detail/has_prefix_operator.hpp index 31987d6..77818c2 100644 --- a/include/boost/type_traits/detail/has_prefix_operator.hpp +++ b/include/boost/type_traits/detail/has_prefix_operator.hpp @@ -34,25 +34,25 @@ namespace boost struct dont_care; - template > + template struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp) : public boost::false_type {}; template - struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp)::type>()) > > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp)::type>()) >::type> : public boost::integral_constant::type>() ), Ret>::value> {}; - template > + template struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp) : public boost::false_type {}; template - struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp)::type>())> > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp)::type>())>::type> : public boost::integral_constant::type>())>::value> {}; - template > + template struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp) : public boost::false_type {}; template - struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp)::type>() )> > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp)::type>() )>::type> : public boost::true_type {}; } diff --git a/include/boost/type_traits/has_minus.hpp b/include/boost/type_traits/has_minus.hpp index 3f6271a..fcd5d94 100644 --- a/include/boost/type_traits/has_minus.hpp +++ b/include/boost/type_traits/has_minus.hpp @@ -52,25 +52,25 @@ namespace boost struct dont_care; - template > + template struct has_minus_ret_imp : public boost::false_type {}; template - struct has_minus_ret_imp::type>() - std::declval::type>())> > + struct has_minus_ret_imp::type>() - std::declval::type>())>::type> : public boost::integral_constant::type>() - std::declval::type>()), Ret>::value> {}; - template > + template struct has_minus_void_imp : public boost::false_type {}; template - struct has_minus_void_imp::type>() - std::declval::type>())> > + struct has_minus_void_imp::type>() - std::declval::type>())>::type> : public boost::integral_constant::type>() - std::declval::type>())>::value> {}; - template > + template struct has_minus_dc_imp : public boost::false_type {}; template - struct has_minus_dc_imp::type>() - std::declval::type>())> > + struct has_minus_dc_imp::type>() - std::declval::type>())>::type> : public boost::true_type {}; template diff --git a/include/boost/type_traits/has_minus_assign.hpp b/include/boost/type_traits/has_minus_assign.hpp index 936ffed..ea3169e 100644 --- a/include/boost/type_traits/has_minus_assign.hpp +++ b/include/boost/type_traits/has_minus_assign.hpp @@ -53,25 +53,25 @@ namespace boost struct dont_care; - template > + template struct has_minus_assign_ret_imp : public boost::false_type {}; template - struct has_minus_assign_ret_imp::type>() -= std::declval::type>())> > + struct has_minus_assign_ret_imp::type>() -= std::declval::type>())>::type> : public boost::integral_constant::type>() -= std::declval::type>()), Ret>::value> {}; - template > + template struct has_minus_assign_void_imp : public boost::false_type {}; template - struct has_minus_assign_void_imp::type>() -= std::declval::type>())> > + struct has_minus_assign_void_imp::type>() -= std::declval::type>())>::type> : public boost::integral_constant::type>() -= std::declval::type>())>::value> {}; - template > + template struct has_minus_assign_dc_imp : public boost::false_type {}; template - struct has_minus_assign_dc_imp::type>() -= std::declval::type>())> > + struct has_minus_assign_dc_imp::type>() -= std::declval::type>())>::type> : public boost::true_type {}; template diff --git a/include/boost/type_traits/has_plus_assign.hpp b/include/boost/type_traits/has_plus_assign.hpp index cf012e2..161ca15 100644 --- a/include/boost/type_traits/has_plus_assign.hpp +++ b/include/boost/type_traits/has_plus_assign.hpp @@ -56,25 +56,25 @@ namespace boost struct dont_care; - template > + template struct has_plus_assign_ret_imp : public boost::false_type {}; template - struct has_plus_assign_ret_imp::type>() += std::declval::type>())> > + struct has_plus_assign_ret_imp::type>() += std::declval::type>())>::type> : public boost::integral_constant::type>() += std::declval::type>()), Ret>::value> {}; - template > + template struct has_plus_assign_void_imp : public boost::false_type {}; template - struct has_plus_assign_void_imp::type>() += std::declval::type>())> > + struct has_plus_assign_void_imp::type>() += std::declval::type>())>::type> : public boost::integral_constant::type>() += std::declval::type>())>::value> {}; - template > + template struct has_plus_assign_dc_imp : public boost::false_type {}; template - struct has_plus_assign_dc_imp::type>() += std::declval::type>())> > + struct has_plus_assign_dc_imp::type>() += std::declval::type>())>::type> : public boost::true_type {}; template diff --git a/include/boost/type_traits/is_virtual_base_of.hpp b/include/boost/type_traits/is_virtual_base_of.hpp index 60ffbc8..fe2cdcf 100644 --- a/include/boost/type_traits/is_virtual_base_of.hpp +++ b/include/boost/type_traits/is_virtual_base_of.hpp @@ -44,7 +44,7 @@ namespace boost { // They can also fall back to the behaviour of reinterpret_cast, which allows is_virtual_base_of to work on non-class types too. // Note that because we are casting pointers there can be no user-defined operators to interfere. template()))>* = + typename boost::make_void()))>::type* = nullptr> constexpr bool is_virtual_base_impl(int) { return false; } diff --git a/test/copy_cv_ref_test.cpp b/test/copy_cv_ref_test.cpp new file mode 100644 index 0000000..974b6fd --- /dev/null +++ b/test/copy_cv_ref_test.cpp @@ -0,0 +1,186 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, +Version 1.0. (See accompanying file LICENSE_1_0.txt +or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifdef TEST_STD +#include +#else +#include +#endif +#include "test.hpp" +#include "check_type.hpp" + +TT_TEST_BEGIN(copy_cv_ref) + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, int&&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const int&&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, volatile int&&); + +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); +BOOST_CHECK_TYPE3(::tt::copy_cv_ref::type, const volatile int&&); +#endif + +TT_TEST_END diff --git a/test/copy_reference_test.cpp b/test/copy_reference_test.cpp new file mode 100644 index 0000000..e304288 --- /dev/null +++ b/test/copy_reference_test.cpp @@ -0,0 +1,33 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, +Version 1.0. (See accompanying file LICENSE_1_0.txt +or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifdef TEST_STD +#include +#else +#include +#endif +#include "test.hpp" +#include "check_type.hpp" + +TT_TEST_BEGIN(copy_reference) + +BOOST_CHECK_TYPE3(::tt::copy_reference::type, int); +BOOST_CHECK_TYPE3(::tt::copy_reference::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_reference::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_reference::type, int&); + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +BOOST_CHECK_TYPE3(::tt::copy_reference::type, int&&); +BOOST_CHECK_TYPE3(::tt::copy_reference::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_reference::type, int&&); +BOOST_CHECK_TYPE3(::tt::copy_reference::type, int&); +BOOST_CHECK_TYPE3(::tt::copy_reference::type, int&&); +#endif + +TT_TEST_END diff --git a/test/is_assignable_test.cpp b/test/is_assignable_test.cpp index 5eb2e7a..8798dd4 100644 --- a/test/is_assignable_test.cpp +++ b/test/is_assignable_test.cpp @@ -27,7 +27,7 @@ struct non_assignable struct noexcept_assignable { noexcept_assignable(); - noexcept_assignable& operator=(const non_assignable&)noexcept; + noexcept_assignable& operator=(const noexcept_assignable&)noexcept; }; #endif