Boost logo

Boost Users :

Subject: Re: [Boost-users] detect if a type has a size_t member
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-07-29 09:07:23


Roman Perepelitsa wrote:
> 2009/7/29 Mathias Gaunard <mathias.gaunard_at_[hidden]
> <mailto:mathias.gaunard_at_[hidden]>>
>
> 1) struct S {
> static const size_t maxsize =5;
> };

> It explains why 2 returns false, but does not explain why 1 does not
> compile.

Because static const <integral type> = <some value> members are quite
special beasts.
Indeed, unlike other static members, you can't take their address, since
they don't exist in memory but only as compile-time constants.

Testing whether the type is integral is not enough either, since if
there is no definition they behave like normal static members.


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