
22 Mar
2005
22 Mar
'05
12:16 p.m.
"Jens Theisen" <jens.theisen@transversal.com> wrote in message news:d1okmn$bjv$1@sea.gmane.org... | Thorsten Ottosen wrote: | > | v = 0?v: list_of(...) | > | | > | FWIW ;-) | > | > that is neat too, but still not optimal. How portable would | > SFINAE work with is_container<T>::value based on | > detecting member functions begin,end,size,empty ? | | How do you want to apply SNIFAE in a conversion operator? Hm.. yeah, I thought something like #include <boost/utility/enable_if.hpp> #include <boost/type_traits/is_same.hpp> using namespace boost; struct Foo { template< class T > operator typename enable_if< is_same<T,int>, int>::type() { return 0; } }; int main() { Foo f; int i = f; } would work.