[Bug c++/71886] Incorrect error on operator() being an member in template
tomaszkam at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jul 14 21:18:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71886
--- Comment #1 from Tomasz Kamiński <tomaszkam at gmail dot com> ---
Such code is useful, for example in case of variant<T1, T2, T3> universal
constructor from U&&, where there is a need to determine best candidate among
the function taking parameter each type be value.
This may be implemented using:
template<typename Sig>
struct single_call
{
Sig operator();
};
template<typename... Sigs>
struct multiple_calls : single_call<Sigs>...
{
using single_call<Sigs>::operator()...;
};
Then to determine an index of type to be constructed can be done by:
decltype(multiple_calls<std::integer_sequence<Is>(Ts)...>)::value
Where Is is [0,1,2] and Ts is [T0, T1, T2].
More information about the Gcc-bugs
mailing list