Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2006-08-05 07:47:27


On Fri, 4 Aug 2006 21:18:46 -0500, "Michael Marcin"
<mmarcin_at_[hidden]> wrote:

>float myfloats[24] = {0};
>size_t count = sizeof boost::count_of( myfloats ); // count = 24
>
>This seems to suggest you are getting the size of the count of the array.

I know. But if you want a compile-time constant from an expression
there are not many alternatives. It could be hidden behind a macro,
though. In this respect, sizeof dimension<> is better, though still
"size of" has not to be interpreted as "number of bytes of". Somewhere
in the code you should find a commented out #define which had the
purpose to allow using a lowercase "countof" in lieu of "sizeof". Not
acceptable for our guidelines, but you could perhaps use it.

--
[ Gennaro Prota, C++ developer for hire ]

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk