21 Feb
2008
21 Feb
'08
7 p.m.
Alexander Nasonov
struct Cases { template<class N> void operator()(N) const { ... }
void operator()(default_t) const { ... } };
The trick posted on RSDN lets me check whether the last call operator exists and take this into account.
One useful generalisation of this trick is something like
result_of_with_default
In order for the above to work, Cases::operator()(N) must be more specialised:
struct Cases {
template<int N>
void operator()(mpl::int_<N>) const { ... }
// void operator()(default_t) const { ... }
};
So, result_of_with_default