Boost logo

Boost Users :

Subject: [Boost-users] mpl eval_if and has_member_data use
From: Hicham Mouline (hicham_at_[hidden])
Date: 2009-07-30 06:00:09


Hello,

I have

BOOST_HAS_STATIC_MEMBER_DATA(size_t, maxsize) // from introspection in
sandbox

template <typename T>
class C {

  static const size_t s =
           boost::mpl::eval_if<
             boost::introspection::has_static_member_data_maxsize<T>,
             boost::mpl::size_t<T::maxsize>,
             boost::mpl::size_t<0>
>::value;
};

if T has maxsize size_t member, then s should get maxsize and if it doesn't,
s should be 0.

I get a compile error for cases where T doesn't have maxsize, because I
still refer to it.

e.g. of T

struct Texample {
 ...
 static const size_t maxsize = 5;
};

Regards,


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