I wonder about the advantages of the new operator sizeof...
(not to be confused with the sizeof
operator). I searched the web and found a few examples that seem all like the following one:
template<class... ArgTypes>
std::size_t GetLength()
{
return sizeof...(ArgTypes);
}
I think the examples are not illustrative.
Are there any real examples to illustrate that sizeof...
is very useful?
Updates:
I found another examples from here that seem more meaningful:
template<class ...A> void func(A ...args){
typedef typename common_type<A...>::type common;
std::array<common, sizeof...(A)> a = {{ args... }};
}
template<typename... A> int func(const A&... args)
{
boost::any arr[sizeof...(A)] = { args... };
return 0;
}