// // bind_typeof_test.cpp - test for bind/typeof.hpp // // Copyright (c) 2009 Gevorg Voskanyan // // 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) // #define BOOST_TYPEOF_COMPLIANT #include #include #include #include template < typename TestType, typename DeducedType > void test_against_deduced_type( DeducedType ) { BOOST_TEST(( boost::is_same< TestType, DeducedType >::value )); } #define TEST_AGAINST_DEDUCED_TYPE(Expr) test_against_deduced_type< BOOST_TYPEOF( Expr ) >( Expr ) #define TYPEOF_TEST(Expr) TEST_AGAINST_DEDUCED_TYPE( Expr ) void f0() {} void f1( int ) {} void f2( int, int ) {} void f3( int, int, int ) {} void f4( int, int, int, int ) {} void f5( int, int, int, int, int ) {} void f6( int, int, int, int, int, int ) {} void f7( int, int, int, int, int, int, int ) {} void f8( int, int, int, int, int, int, int, int ) {} void f9( int, int, int, int, int, int, int, int, int ) {} int main() { TYPEOF_TEST( boost::bind( &f0 ) ); TYPEOF_TEST( boost::bind( &f1, _1 ) ); TYPEOF_TEST( boost::bind( &f2, _1, 0 ) ); TYPEOF_TEST( boost::bind( &f3, _1, 0, _2 ) ); TYPEOF_TEST( boost::bind( &f4, _1, 0, _2, 0 ) ); TYPEOF_TEST( boost::bind( &f5, _1, 0, _2, 0, _3 ) ); TYPEOF_TEST( boost::bind( &f6, _1, 0, _2, 0, _3, 0 ) ); TYPEOF_TEST( boost::bind( &f7, _1, 0, _2, 0, _3, 0, _4 ) ); TYPEOF_TEST( boost::bind( &f8, _1, 0, _2, 0, _3, 0, _4, 0 ) ); TYPEOF_TEST( boost::bind( &f9, _1, 0, _2, 0, _3, 0, _4, 0, _5 ) ); TYPEOF_TEST( boost::bind( &f9, _1, _2, _3, _4, _5, _6, _7, _8, _9 ) ); return boost::report_errors(); }