Use BOOST_TEST_TRAIT_SAME

This commit is contained in:
Peter Dimov
2022-12-23 05:38:26 +02:00
parent 395235f3aa
commit 9a59a15e28
3 changed files with 5 additions and 7 deletions

View File

@ -6,6 +6,6 @@ include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(HAVE_BOOST_TEST)
boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::bind Boost::core Boost::function Boost::smart_ptr Boost::type_traits)
boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::bind Boost::core Boost::function Boost::smart_ptr)
endif()

View File

@ -4,12 +4,11 @@
#include <boost/bind/apply.hpp>
#include <boost/core/lightweight_test_trait.hpp>
#include <boost/type_traits/is_same.hpp>
int main()
{
BOOST_TEST_TRAIT_TRUE((boost::is_same<void, boost::apply<void>::result_type>));
BOOST_TEST_TRAIT_TRUE((boost::is_same<int&, boost::apply<int&>::result_type>));
BOOST_TEST_TRAIT_SAME(void, boost::apply<void>::result_type);
BOOST_TEST_TRAIT_SAME(int&, boost::apply<int&>::result_type);
return boost::report_errors();
}

View File

@ -6,11 +6,10 @@
#include <boost/bind/protect.hpp>
#include <boost/core/lightweight_test_trait.hpp>
#include <boost/type_traits/is_same.hpp>
template<class T, class F> void test( F )
{
BOOST_TEST_TRAIT_TRUE((boost::is_same<typename T::result_type, typename F::result_type>));
BOOST_TEST_TRAIT_SAME(typename T::result_type, typename F::result_type);
}
struct X
@ -29,7 +28,7 @@ template<class T, class U> struct inherit: T, U
template<class F> void test2( F )
{
// test that F doesn't have ::result_type
BOOST_TEST_TRAIT_TRUE((boost::is_same<typename inherit<F, X>::result_type, typename X::result_type>));
BOOST_TEST_TRAIT_SAME(typename inherit<F, X>::result_type, typename X::result_type);
}
int main()