forked from boostorg/type_traits
Merge pull request #112 from glenfe/develop
Implement copy_reference and copy_cv_ref
This commit is contained in:
65
doc/copy_cv_ref.qbk
Normal file
65
doc/copy_cv_ref.qbk
Normal file
@ -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<class T, class U>
|
||||
struct copy_cv_ref
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template<class T, class U>
|
||||
using copy_cv_ref_t = typename copy_cv_ref<T, U>::type;
|
||||
|
||||
__type [^T /cvref/], where /cvref/ are the cvref-qualifiers of `U`.
|
||||
|
||||
__header `#include <boost/type_traits/copy_cv_ref.hpp>` or
|
||||
`#include <boost/type_traits.hpp>>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[[Expression] [Result Type]]
|
||||
|
||||
[[`copy_cv_ref<int, const char>::type`][`const int`]]
|
||||
|
||||
[[`copy_cv_ref<int, volatile char>::type`][`volatile int`]]
|
||||
|
||||
[[`copy_cv_ref<int, const volatile char>::type`][`const volatile int`]]
|
||||
|
||||
[[`copy_cv_ref<int, char&>::type`][`int&`]]
|
||||
|
||||
[[`copy_cv_ref<int, const char&>::type`][`const int&`]]
|
||||
|
||||
[[`copy_cv_ref<int, volatile char&>::type`][`volatile int&`]]
|
||||
|
||||
[[`copy_cv_ref<int, const volatile char&>::type`][`const volatile int&`]]
|
||||
|
||||
[[`copy_cv_ref<int, char&&>::type`][`int&&`]]
|
||||
|
||||
[[`copy_cv_ref<int, const char&&>::type`][`const int&&`]]
|
||||
|
||||
[[`copy_cv_ref<int, volatile char&&>::type`][`volatile int&&`]]
|
||||
|
||||
[[`copy_cv_ref<int, const volatile char&&>::type`][`const volatile int&&`]]
|
||||
|
||||
[[`copy_cv_ref<int&&, char&>::type`][`int&`]]
|
||||
|
||||
[[`copy_cv_ref<int&, const char>::type`][`int&`]]
|
||||
|
||||
[[`copy_cv_ref<int&, volatile char&>::type`][`int&`]]
|
||||
|
||||
[[`copy_cv_ref<int&, const volatile char&&>::type`][`int&`]]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers] The type alias `copy_cv_ref_t` is only available if the compiler
|
||||
supports template aliases.
|
||||
|
||||
[endsect]
|
53
doc/copy_reference.qbk
Normal file
53
doc/copy_reference.qbk
Normal file
@ -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<class T, class U>
|
||||
struct copy_reference
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template<class T, class U>
|
||||
using copy_reference_t = typename copy_reference<T, U>::type;
|
||||
|
||||
__type [^T /ref/], where /ref/ are the ref-qualifiers of `U`.
|
||||
|
||||
__header `#include <boost/type_traits/copy_reference.hpp>` or
|
||||
`#include <boost/type_traits.hpp>>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[[Expression] [Result Type]]
|
||||
|
||||
[[`copy_reference<int, char>::type`][`int`]]
|
||||
|
||||
[[`copy_reference<int, char&>::type`] [`int&`]]
|
||||
|
||||
[[`copy_reference<int, char&&>::type`] [`int&&`]]
|
||||
|
||||
[[`copy_reference<int&, char>::type`] [`int&`]]
|
||||
|
||||
[[`copy_reference<int&, char&>::type`] [`int&`]]
|
||||
|
||||
[[`copy_reference<int&, char&&>::type`] [`int&`]]
|
||||
|
||||
[[`copy_reference<int&&, char>::type`] [`int&&`]]
|
||||
|
||||
[[`copy_reference<int&&, char&>::type`] [`int&`]]
|
||||
|
||||
[[`copy_reference<int&&, char&&>::type`] [`int&&`]]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers] The type alias `copy_reference_t` is only available if the compiler
|
||||
supports template aliases.
|
||||
|
||||
[endsect]
|
@ -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]
|
||||
|
||||
|
@ -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]
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <boost/type_traits/common_type.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#include <boost/type_traits/copy_cv.hpp>
|
||||
#include <boost/type_traits/copy_cv_ref.hpp>
|
||||
#include <boost/type_traits/copy_reference.hpp>
|
||||
#include <boost/type_traits/decay.hpp>
|
||||
#include <boost/type_traits/declval.hpp>
|
||||
#include <boost/type_traits/enable_if.hpp>
|
||||
|
31
include/boost/type_traits/copy_cv_ref.hpp
Normal file
31
include/boost/type_traits/copy_cv_ref.hpp
Normal file
@ -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 <boost/type_traits/copy_cv.hpp>
|
||||
#include <boost/type_traits/copy_reference.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class T, class U>
|
||||
struct copy_cv_ref {
|
||||
typedef typename copy_reference<typename copy_cv<T,
|
||||
typename remove_reference<U>::type >::type, U>::type type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
template<class T, class U>
|
||||
using copy_cv_ref_t = typename copy_cv_ref<T, U>::type;
|
||||
#endif
|
||||
|
||||
} /* boost */
|
||||
|
||||
#endif
|
35
include/boost/type_traits/copy_reference.hpp
Normal file
35
include/boost/type_traits/copy_reference.hpp
Normal file
@ -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 <boost/type_traits/add_lvalue_reference.hpp>
|
||||
#include <boost/type_traits/add_rvalue_reference.hpp>
|
||||
#include <boost/type_traits/is_lvalue_reference.hpp>
|
||||
#include <boost/type_traits/is_rvalue_reference.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class T, class U>
|
||||
struct copy_reference {
|
||||
typedef typename conditional<is_rvalue_reference<U>::value,
|
||||
typename add_rvalue_reference<T>::type,
|
||||
typename conditional<is_lvalue_reference<U>::value,
|
||||
typename add_lvalue_reference<T>::type, T>::type>::type type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
template<class T, class U>
|
||||
using copy_reference_t = typename copy_reference<T, U>::type;
|
||||
#endif
|
||||
|
||||
} /* boost */
|
||||
|
||||
#endif
|
186
test/copy_cv_ref_test.cpp
Normal file
186
test/copy_cv_ref_test.cpp
Normal file
@ -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 <type_traits>
|
||||
#else
|
||||
#include <boost/type_traits/copy_cv_ref.hpp>
|
||||
#endif
|
||||
#include "test.hpp"
|
||||
#include "check_type.hpp"
|
||||
|
||||
TT_TEST_BEGIN(copy_cv_ref)
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, char>::type, int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, const char>::type, const int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, volatile char>::type, volatile int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, const volatile char>::type, const volatile int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, char&>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, const char&>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, volatile char&>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, const volatile char&>::type, const volatile int&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, char>::type, const int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, const char>::type, const int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, volatile char>::type, const volatile int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, const volatile char>::type, const volatile int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, char&>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, const char&>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, volatile char&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, const volatile char&>::type, const volatile int&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, char>::type, volatile int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, const char>::type, const volatile int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, volatile char>::type, volatile int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, const volatile char>::type, const volatile int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, char&>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, const char&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, volatile char&>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, const volatile char&>::type, const volatile int&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, char>::type, const volatile int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, const char>::type, const volatile int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, volatile char>::type, const volatile int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, const volatile char>::type, const volatile int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, char&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, const char&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, volatile char&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, const volatile char&>::type, const volatile int&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, char>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, const char>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, volatile char>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, const volatile char>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, char&>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, const char&>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, volatile char&>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, const volatile char&>::type, int&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, char>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, const char>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, volatile char>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, const volatile char>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, char&>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, const char&>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, volatile char&>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, const volatile char&>::type, const int&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, char>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, const char>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, volatile char>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, const volatile char>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, char&>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, const char&>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, volatile char&>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, const volatile char&>::type, volatile int&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, char>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, const char>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, volatile char>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, const volatile char>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, char&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, const char&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, volatile char&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, const volatile char&>::type, const volatile int&);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, char&&>::type, int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, const char&&>::type, const int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, volatile char&&>::type, volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, const volatile char&&>::type, const volatile int&&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, char&&>::type, const int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, const char&&>::type, const int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, volatile char&&>::type, const volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, const volatile char&&>::type, const volatile int&&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, char&&>::type, volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, const char&&>::type, const volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, volatile char&&>::type, volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, const volatile char&&>::type, const volatile int&&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, char&&>::type, const volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, const char&&>::type, const volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, volatile char&&>::type, const volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, const volatile char&&>::type, const volatile int&&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, char&&>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, const char&&>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, volatile char&&>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, const volatile char&&>::type, int&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, char&&>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, const char&&>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, volatile char&&>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, const volatile char&&>::type, const int&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, char&&>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, const char&&>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, volatile char&&>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, const volatile char&&>::type, volatile int&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, char&&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, const char&&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, volatile char&&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, const volatile char&&>::type, const volatile int&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, char>::type, int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, const char>::type, int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, volatile char>::type, int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, const volatile char>::type, int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, char&>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, const char&>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, volatile char&>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, const volatile char&>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, char&&>::type, int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, const char&&>::type, int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, volatile char&&>::type, int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, const volatile char&&>::type, int&&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, char>::type, const int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, const char>::type, const int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, volatile char>::type, const int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, const volatile char>::type, const int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, char&>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, const char&>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, volatile char&>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, const volatile char&>::type, const int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, char&&>::type, const int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, const char&&>::type, const int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, volatile char&&>::type, const int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, const volatile char&&>::type, const int&&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, char>::type, volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, const char>::type, volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, volatile char>::type, volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, const volatile char>::type, volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, char&>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, const char&>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, volatile char&>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, const volatile char&>::type, volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, char&&>::type, volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, const char&&>::type, volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, volatile char&&>::type, volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, const volatile char&&>::type, volatile int&&);
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, char>::type, const volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, const char>::type, const volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, volatile char>::type, const volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, const volatile char>::type, const volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, char&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, const char&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, volatile char&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, const volatile char&>::type, const volatile int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, char&&>::type, const volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, const char&&>::type, const volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, volatile char&&>::type, const volatile int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, const volatile char&&>::type, const volatile int&&);
|
||||
#endif
|
||||
|
||||
TT_TEST_END
|
33
test/copy_reference_test.cpp
Normal file
33
test/copy_reference_test.cpp
Normal file
@ -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 <type_traits>
|
||||
#else
|
||||
#include <boost/type_traits/copy_reference.hpp>
|
||||
#endif
|
||||
#include "test.hpp"
|
||||
#include "check_type.hpp"
|
||||
|
||||
TT_TEST_BEGIN(copy_reference)
|
||||
|
||||
BOOST_CHECK_TYPE3(::tt::copy_reference<int, char>::type, int);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_reference<int, char&>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_reference<int&, char>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_reference<int&, char&>::type, int&);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
BOOST_CHECK_TYPE3(::tt::copy_reference<int, char&&>::type, int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_reference<int&, char&&>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_reference<int&&, char>::type, int&&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_reference<int&&, char&>::type, int&);
|
||||
BOOST_CHECK_TYPE3(::tt::copy_reference<int&&, char&&>::type, int&&);
|
||||
#endif
|
||||
|
||||
TT_TEST_END
|
Reference in New Issue
Block a user