Boost logo

Boost Users :

From: Rozental, Gennadiy (gennadiy.rozental_at_[hidden])
Date: 2004-05-11 14:09:10


> It already works. If you want to detect STL sequence-ness, you'll
> have to try some nasty hacks. I'm have doubts about whether it's even
> possible to approximate that metafunction in portable code.

Wouldn't something about these lines work?

template<typename T>
char test( T const&, long );

template<typename T>
int test( std::list<T> const&, int );

template<typename T>
struct is_list
{
    static T t;
    enum { value = sizeof( test( t, 0 ) ) == 4; }
};

Gennadiy.


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