23 May
2009
23 May
'09
10:30 a.m.
2009/5/23 Zachary Turner
Suppose I have a template function
template<typename T> void f(const std::string&, T);
which I want there to be a couple of different variants of.
Version 1 - Enabled if and only if boost::is_same
Version 2 - Enabled if and only if boost::is_same (foo is a class) Version 3 - Enabled if and only if boost::is_enum<T> Version 4 - Otherwise Is there an easy way to express this? It seems I run into a bunch of overload ambiguity problems. I'm sure I can get around this by adding to every version the negation of all the other conditions, but this seems unnecessarily complicated.
1, 2 and 3 are disjoint, so you can use them as is. For 4 use negation of 1, 2 and 3. Roman Perepelitsa.