6 Jun
2007
6 Jun
'07
6:23 p.m.
On 06/06/07, Bill Buklis
For a template class I'd like to add * and -> operators for types that support it (mainly pointers). However, most instantiations of this class won't be pointers and therefore these operators won't be valid. I understand that enable_if can't directly support member functions. But, how can I do the equivalent of this?
[code snipped]
SFINAE -- you don't even need boost:
template <typename T>
struct holder {
T value;
T operator->() const { return value; }
};
struct foo { int bar; };
int main() {
holder