core/test/is_same_test.cpp
Andrey Semashev 86bf1d4aec 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.
2022-12-22 17:55:47 +03:00

39 lines
1.2 KiB
C++

//
// Test for core::detail::is_same<T1,T2>
//
// Copyright 2014 Peter Dimov
//
// 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
//
#include <boost/core/detail/is_same.hpp>
#include <boost/core/lightweight_test_trait.hpp>
struct X
{
};
struct Y
{
};
int main()
{
BOOST_TEST_TRAIT_TRUE(( boost::core::detail::is_same<X, X> ));
BOOST_TEST_TRAIT_TRUE(( boost::core::detail::is_same<Y, Y> ));
BOOST_TEST_TRAIT_TRUE(( boost::core::detail::is_same<void, void> ));
BOOST_TEST_TRAIT_TRUE(( boost::core::detail::is_same<int, int> ));
BOOST_TEST_TRAIT_TRUE(( boost::core::detail::is_same<void const volatile, void const volatile> ));
BOOST_TEST_TRAIT_FALSE(( boost::core::detail::is_same<X, Y> ));
BOOST_TEST_TRAIT_FALSE(( boost::core::detail::is_same<X, X const> ));
BOOST_TEST_TRAIT_FALSE(( boost::core::detail::is_same<X, void> ));
BOOST_TEST_TRAIT_FALSE(( boost::core::detail::is_same<X, int> ));
BOOST_TEST_TRAIT_FALSE(( boost::core::detail::is_same<int, void> ));
BOOST_TEST_TRAIT_FALSE(( boost::core::detail::is_same<void, void const volatile> ));
return boost::report_errors();
}