mirror of
https://github.com/boostorg/function.git
synced 2025-07-29 12:27:15 +02:00
Sync from upstream.
This commit is contained in:
@ -586,17 +586,112 @@ namespace boost {
|
||||
struct variadic_function_base
|
||||
{};
|
||||
|
||||
template <typename T>
|
||||
struct variadic_function_base<T>
|
||||
template <typename T1>
|
||||
struct variadic_function_base<T1>
|
||||
{
|
||||
typedef T argument_type;
|
||||
typedef T1 argument_type;
|
||||
typedef T1 arg1_type;
|
||||
};
|
||||
|
||||
template <typename T0, typename T1>
|
||||
struct variadic_function_base<T0, T1>
|
||||
template <typename T1, typename T2>
|
||||
struct variadic_function_base<T1, T2>
|
||||
{
|
||||
typedef T0 first_argument_type;
|
||||
typedef T1 second_argument_type;
|
||||
typedef T1 first_argument_type;
|
||||
typedef T2 second_argument_type;
|
||||
typedef T1 arg1_type;
|
||||
typedef T2 arg2_type;
|
||||
};
|
||||
|
||||
template <typename T1, typename T2, typename T3>
|
||||
struct variadic_function_base<T1, T2, T3>
|
||||
{
|
||||
typedef T1 arg1_type;
|
||||
typedef T2 arg2_type;
|
||||
typedef T3 arg3_type;
|
||||
};
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4>
|
||||
struct variadic_function_base<T1, T2, T3, T4>
|
||||
{
|
||||
typedef T1 arg1_type;
|
||||
typedef T2 arg2_type;
|
||||
typedef T3 arg3_type;
|
||||
typedef T4 arg4_type;
|
||||
};
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
struct variadic_function_base<T1, T2, T3, T4, T5>
|
||||
{
|
||||
typedef T1 arg1_type;
|
||||
typedef T2 arg2_type;
|
||||
typedef T3 arg3_type;
|
||||
typedef T4 arg4_type;
|
||||
typedef T5 arg5_type;
|
||||
};
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
struct variadic_function_base<T1, T2, T3, T4, T5, T6>
|
||||
{
|
||||
typedef T1 arg1_type;
|
||||
typedef T2 arg2_type;
|
||||
typedef T3 arg3_type;
|
||||
typedef T4 arg4_type;
|
||||
typedef T5 arg5_type;
|
||||
typedef T6 arg6_type;
|
||||
};
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
struct variadic_function_base<T1, T2, T3, T4, T5, T6, T7>
|
||||
{
|
||||
typedef T1 arg1_type;
|
||||
typedef T2 arg2_type;
|
||||
typedef T3 arg3_type;
|
||||
typedef T4 arg4_type;
|
||||
typedef T5 arg5_type;
|
||||
typedef T6 arg6_type;
|
||||
typedef T7 arg7_type;
|
||||
};
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
||||
struct variadic_function_base<T1, T2, T3, T4, T5, T6, T7, T8>
|
||||
{
|
||||
typedef T1 arg1_type;
|
||||
typedef T2 arg2_type;
|
||||
typedef T3 arg3_type;
|
||||
typedef T4 arg4_type;
|
||||
typedef T5 arg5_type;
|
||||
typedef T6 arg6_type;
|
||||
typedef T7 arg7_type;
|
||||
typedef T8 arg8_type;
|
||||
};
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
struct variadic_function_base<T1, T2, T3, T4, T5, T6, T7, T8, T9>
|
||||
{
|
||||
typedef T1 arg1_type;
|
||||
typedef T2 arg2_type;
|
||||
typedef T3 arg3_type;
|
||||
typedef T4 arg4_type;
|
||||
typedef T5 arg5_type;
|
||||
typedef T6 arg6_type;
|
||||
typedef T7 arg7_type;
|
||||
typedef T8 arg8_type;
|
||||
typedef T9 arg9_type;
|
||||
};
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
|
||||
struct variadic_function_base<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
|
||||
{
|
||||
typedef T1 arg1_type;
|
||||
typedef T2 arg2_type;
|
||||
typedef T3 arg3_type;
|
||||
typedef T4 arg4_type;
|
||||
typedef T5 arg5_type;
|
||||
typedef T6 arg6_type;
|
||||
typedef T7 arg7_type;
|
||||
typedef T8 arg8_type;
|
||||
typedef T9 arg9_type;
|
||||
typedef T10 arg10_type;
|
||||
};
|
||||
|
||||
#if defined( BOOST_LIBSTDCXX_VERSION ) && BOOST_LIBSTDCXX_VERSION < 50000
|
||||
|
@ -47,6 +47,7 @@ run rvalues_test.cpp : : : <source>/boost/move//boost_move ;
|
||||
compile function_typeof_test.cpp
|
||||
: <cxxstd>03:<build>no <cxxstd>98:<build>no <cxxstd>0x:<build>no ;
|
||||
run result_arg_types_test.cpp ;
|
||||
run result_arg_n_types_test.cpp ;
|
||||
|
||||
lib throw_bad_function_call : throw_bad_function_call.cpp : <link>shared:<define>THROW_BAD_FUNCTION_CALL_DYN_LINK=1 ;
|
||||
|
||||
|
146
test/result_arg_n_types_test.cpp
Normal file
146
test/result_arg_n_types_test.cpp
Normal file
@ -0,0 +1,146 @@
|
||||
// Copyright 2024 Peter Dimov
|
||||
// Use, modification and distribution is subject to
|
||||
// the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/core/lightweight_test_trait.hpp>
|
||||
|
||||
struct R {};
|
||||
|
||||
struct A1 {};
|
||||
struct A2 {};
|
||||
struct A3 {};
|
||||
struct A4 {};
|
||||
struct A5 {};
|
||||
struct A6 {};
|
||||
struct A7 {};
|
||||
struct A8 {};
|
||||
struct A9 {};
|
||||
struct A10 {};
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef boost::function<R()> F;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME(F::result_type, R);
|
||||
}
|
||||
|
||||
{
|
||||
typedef boost::function<R(A1)> F;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME(F::result_type, R);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
|
||||
}
|
||||
|
||||
{
|
||||
typedef boost::function<R(A1, A2)> F;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME(F::result_type, R);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
|
||||
}
|
||||
|
||||
{
|
||||
typedef boost::function<R(A1, A2, A3)> F;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME(F::result_type, R);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
|
||||
}
|
||||
|
||||
{
|
||||
typedef boost::function<R(A1, A2, A3, A4)> F;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME(F::result_type, R);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg4_type, A4);
|
||||
}
|
||||
|
||||
{
|
||||
typedef boost::function<R(A1, A2, A3, A4, A5)> F;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME(F::result_type, R);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg4_type, A4);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg5_type, A5);
|
||||
}
|
||||
|
||||
{
|
||||
typedef boost::function<R(A1, A2, A3, A4, A5, A6)> F;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME(F::result_type, R);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg4_type, A4);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg5_type, A5);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg6_type, A6);
|
||||
}
|
||||
|
||||
{
|
||||
typedef boost::function<R(A1, A2, A3, A4, A5, A6, A7)> F;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME(F::result_type, R);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg4_type, A4);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg5_type, A5);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg6_type, A6);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg7_type, A7);
|
||||
}
|
||||
|
||||
{
|
||||
typedef boost::function<R(A1, A2, A3, A4, A5, A6, A7, A8)> F;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME(F::result_type, R);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg4_type, A4);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg5_type, A5);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg6_type, A6);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg7_type, A7);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg8_type, A8);
|
||||
}
|
||||
|
||||
{
|
||||
typedef boost::function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> F;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME(F::result_type, R);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg4_type, A4);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg5_type, A5);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg6_type, A6);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg7_type, A7);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg8_type, A8);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg9_type, A9);
|
||||
}
|
||||
|
||||
{
|
||||
typedef boost::function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> F;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME(F::result_type, R);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg1_type, A1);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg2_type, A2);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg3_type, A3);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg4_type, A4);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg5_type, A5);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg6_type, A6);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg7_type, A7);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg8_type, A8);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg9_type, A9);
|
||||
BOOST_TEST_TRAIT_SAME(F::arg10_type, A10);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user