
Gennadiy Rozental <rogeeff <at> gmail.com> writes:
Here:
http://www.rsdn.ru/forum/message/2720363.1.aspx http://www.rsdn.ru/forum/message/2759773.1.aspx
Thanks Gennadiy for the links, especially for the second one. Two days ago I added recently reviewed boost::switch_ to my project and was thinking of moving default case closer to all other cases. So rather than Cases f; Default dft; switch_(n, f, dft); I would like to switch_(n, f); where Cases is 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<void (Cases)(default_t), no_default_case> which would return no_default_case if you comment the last call operator in Cases. Many thanks, Alex