1
0
forked from boostorg/core

Deprecated boost::core::is_same and the associated header.

Moved is_same implementation to detail (both directory and namespace)
to use in the public headers and avoid introducing new dependencies.
The documentation now recommends users to use Boost.TypeTraits or
C++ standard library instead.

Also, removed unnecessary includes and added missing ones in a few
places.
This commit is contained in:
Andrey Semashev
2022-12-22 15:46:55 +03:00
parent 75c765cc13
commit 86bf1d4aec
34 changed files with 206 additions and 168 deletions

View File

@@ -6,8 +6,8 @@ Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/core/pointer_traits.hpp>
#include <boost/core/is_same.hpp>
#include <boost/core/lightweight_test_trait.hpp>
#include <boost/core/detail/is_same.hpp>
template<class T>
struct P1 { };
@@ -55,94 +55,94 @@ struct R { };
int main()
{
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<char*,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<char*,
boost::pointer_traits<R*>::rebind_to<char>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<char>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<char>,
boost::pointer_traits<P1<R> >::rebind_to<char>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P2<char, R>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P2<char, R>,
boost::pointer_traits<P2<R, R> >::rebind_to<char>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P3<char, R, R>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P3<char, R, R>,
boost::pointer_traits<P3<R, R, R> >::rebind_to<char>::type>));
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P<char, R, R, R>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P<char, R, R, R>,
boost::pointer_traits<P<R, R, R, R> >::rebind_to<char>::type>));
#endif
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<void*,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<void*,
boost::pointer_traits<R*>::rebind_to<void>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<void>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<void>,
boost::pointer_traits<P1<R> >::rebind_to<void>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<R*,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<R*,
boost::pointer_traits<void*>::rebind_to<R>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<R>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<R>,
boost::pointer_traits<P1<void> >::rebind_to<R>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<const int*,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<const int*,
boost::pointer_traits<R*>::rebind_to<const int>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<const int>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<const int>,
boost::pointer_traits<P1<R> >::rebind_to<const int>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int*,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<int*,
boost::pointer_traits<const R*>::rebind_to<int>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<int>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<int>,
boost::pointer_traits<P1<const R> >::rebind_to<int>::type>));
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<char*,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<char*,
boost::pointer_traits<R*>::rebind<char> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<char>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<char>,
boost::pointer_traits<P1<R> >::rebind<char> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P2<char, R>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P2<char, R>,
boost::pointer_traits<P2<R, R> >::rebind<char> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P3<char, R, R>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P3<char, R, R>,
boost::pointer_traits<P3<R, R, R> >::rebind<char> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<void*,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<void*,
boost::pointer_traits<R*>::rebind<void> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<void>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<void>,
boost::pointer_traits<P1<R> >::rebind<void> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<R*,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<R*,
boost::pointer_traits<void*>::rebind<R> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<R>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<R>,
boost::pointer_traits<P1<void> >::rebind<R> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<const int*,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<const int*,
boost::pointer_traits<R*>::rebind<const int> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<const int>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<const int>,
boost::pointer_traits<P1<R> >::rebind<const int> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int*,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<int*,
boost::pointer_traits<const R*>::rebind<int> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<int>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<int>,
boost::pointer_traits<P1<const R> >::rebind<int> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<R> >::rebind_to<char>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E2<bool, R>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E2<bool, R>,
boost::pointer_traits<E2<R, R> >::rebind_to<char>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E3<bool, R, R>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E3<bool, R, R>,
boost::pointer_traits<E3<R, R, R> >::rebind_to<char>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<R> >::rebind<char> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E2<bool, R>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E2<bool, R>,
boost::pointer_traits<E2<R, R> >::rebind<char> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E3<bool, R, R>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E3<bool, R, R>,
boost::pointer_traits<E3<R, R, R> >::rebind<char> >));
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P<char, R, R, R>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P<char, R, R, R>,
boost::pointer_traits<P<R, R, R, R> >::rebind<char> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E<bool, R, R, R>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E<bool, R, R, R>,
boost::pointer_traits<E<R, R, R, R> >::rebind_to<char>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E<bool, R, R, R>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E<bool, R, R, R>,
boost::pointer_traits<E<R, R, R, R> >::rebind<char> >));
#endif
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<R> >::rebind_to<void>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<void> >::rebind_to<R>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<R> >::rebind_to<const int>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<const R> >::rebind_to<int>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<R> >::rebind<void> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<void> >::rebind<R> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<R> >::rebind<const int> >));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<const R> >::rebind<int> >));
#endif
return boost::report_errors();