|
Boost Users : |
Subject: Re: [Boost-users] detect if a type has a size_t member
From: Hicham Mouline (hicham_at_[hidden])
Date: 2009-07-29 11:25:19
> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Mathias Gaunard
> Sent: 29 July 2009 15:48
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] detect if a type has a size_t member
>
> Hicham Mouline wrote:
>
> > Nevertheless, I still couldn't figure out how to detect the static const
> > size_t member.
> >
> > Which version to use?
>
> No version allows this at the moment.
> You may, however, try to simply duplicate HAS_STATIC_MEMBER (or whatever
> it's called), change &X::Name to X::Name, and Type* to Type.
Thanks very much,
It worked for me on vs2005 and g++4.3.3
http://codepad.org/wsNi21Pr
at least for the cases I wanted, that is
struct S1 {
static const size_t maxsize= 5;
};
struct S5 {
};
Nevertheless, it failed to compile on g++4.3.3 for
struct S2 {
static size_t maxsize;
};
because of this error:
error: 'S2::maxsize' is not a valid template argument for type 'long
unsigned int' because it is a non-constant expression
but compiled on vs2005 and failed ( which I don't care about )
thanks again,
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