Boost logo

Boost Users :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2008-02-21 14:00:59


Alexander Nasonov <alnsn <at> yandex.ru> writes:
> 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>

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<Cases(default_t), no_default_case>::type
would be no_default_case.

Alex


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net