Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-03-22 07:16:56


"Jens Theisen" <jens.theisen_at_[hidden]> wrote in message
news:d1okmn$bjv$1_at_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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk