detect if a type has a size_t member
Hello template <typename T> struct S { // how to detect T has a member static const size_t value ? // if T has value, define member of S, m1 of type T1, otherwise m2 of type T2 }; Regards,
Hicham Mouline wrote:
Hello
template <typename T> struct S { // how to detect T has a member static const size_t value ? // if T has value, define member of S, m1 of type T1, otherwise m2 of type T2 };
Regards,
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Check the Boost.Vault for th eintrospection library. It has a HAS_STATIC_MEMBER_NAMED meta-function builder -- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of joel Sent: 03 July 2009 17:03 To: boost-users@lists.boost.org Subject: Re: [Boost-users] detect if a type has a size_t member
Hicham Mouline wrote:
Hello
template <typename T> struct S { // how to detect T has a member static const size_t value ? // if T has value, define member of S, m1 of type T1, otherwise m2 of type T2 };
Regards,
Check the Boost.Vault for th eintrospection library. It has a HAS_STATIC_MEMBER_NAMED meta-function builder
Can I put the macro inside the struct S ? I guess not. I'd write: HAS_STATIC_MEMBER_NAMED(T, value) which would return a integral bool or a bool type?
Hicham Mouline wrote:
Can I put the macro inside the struct S ? I guess not. I'd write: HAS_STATIC_MEMBER_NAMED(T, value)
which would return a integral bool or a bool type it works liek BOOST_MPL_HAS_XXXX so put it where you want to define a boolean meta-function. It supports ::value and ::type return mpl boolean.
-- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35
participants (2)
-
Hicham Mouline
-
joel