I had a look at the source of <functional>
in libstdc++ (g++ 4.7.1) and found the following code (l. 91 - 98):
/// Retrieve the result type for a function type.
template<typename _Res, typename... _ArgTypes>
struct _Weak_result_type_impl<_Res(_ArgTypes...)> // (1)
{ typedef _Res result_type; };
template<typename _Res, typename... _ArgTypes>
struct _Weak_result_type_impl<_Res(_ArgTypes......)> // (2) line 97
{ typedef _Res result_type; };
While I recognize the usual pack expansion ...
(1) [temp.variadic], I have no idea what ......
is.
What does ......
(2) mean in this context?
Follow-up question
In the following minimal example, what type would I need for TEST_PARAM_3
such that tester<TEST_PARAM_3>::value == 2
?
#include <iostream>
#include <type_traits>
#include <iomanip>
template <typename Functor>
struct tester : std::integral_constant<int, 0>{};
template <typename Res, typename... Args>
struct tester<Res(Args...)> : std::integral_constant<int, 1>{};
template <typename Res, typename... Args>
struct tester<Res(Args......)> : std::integral_constant<int, 2>{};
#define STR_EXPAND(tok) #tok
#define STR(tok) STR_EXPAND(tok)
#define TEST_PARAM_1 void(*)(int, int)
#define TEST_PARAM_2 void(int, char, std::ostream&)
#define TEST_PARAM_3 void()
int main(){
using std::setw;
std::cout
<< setw(65)<< STR(TEST_PARAM_1) ": " << tester<TEST_PARAM_1>::value << "\n"
<< setw(65)<< STR(TEST_PARAM_2) ": " << tester<TEST_PARAM_2>::value << "\n"
<< setw(65)<< STR(TEST_PARAM_3) ": " << tester<TEST_PARAM_3>::value << "\n";
}