U
usenet only_tech_talk
Hello,
I tested the code below on a boost::array<> which defines
static const size_type static_size = N;
and it fails. See http://www.boost.org/doc/libs/1_42_0/doc/html/boost/array.html
Am I getting the pointer signature wrong for a static mv? Note that a
similar test works for size() (see the code that is commented out).
Any suggestion would be appreciated. Thanks.
template<typename T>
struct has_static_size{
typedef typename T::size_type size_type;
typedef char yes;
typedef char (&no)[2];
typedef const size_type* sig;
// typedef size_type (const T::*sig)();
template<typename U,sig>
struct sfinae { };
template<typename U> static yes test(sfinae<U, &U::static_size>
*);
//template<typename U> static yes test(sfinae<U,&U::size> *);
template<typename U> static no test(...);
BOOST_STATIC_CONSTANT(
bool,
value = sizeof( test<T>(0) ) == sizeof(yes)
);
typedef boost::mpl::bool_<value> type;
};
I tested the code below on a boost::array<> which defines
static const size_type static_size = N;
and it fails. See http://www.boost.org/doc/libs/1_42_0/doc/html/boost/array.html
Am I getting the pointer signature wrong for a static mv? Note that a
similar test works for size() (see the code that is commented out).
Any suggestion would be appreciated. Thanks.
template<typename T>
struct has_static_size{
typedef typename T::size_type size_type;
typedef char yes;
typedef char (&no)[2];
typedef const size_type* sig;
// typedef size_type (const T::*sig)();
template<typename U,sig>
struct sfinae { };
template<typename U> static yes test(sfinae<U, &U::static_size>
*);
//template<typename U> static yes test(sfinae<U,&U::size> *);
template<typename U> static no test(...);
BOOST_STATIC_CONSTANT(
bool,
value = sizeof( test<T>(0) ) == sizeof(yes)
);
typedef boost::mpl::bool_<value> type;
};