Boost logo

Boost :

From: Philippe Vaucher (philippe.vaucher_at_[hidden])
Date: 2006-06-28 09:26:47


>
> I'm pretty sure it's easier than this. IIRC, the macro can still do
> the old sizeof(a)/sizeof(a[0]) trick; it just needs to add something
> that will cause an error if a is not an array.
>

So basically smth like:

#define COUNT_OF(arr) BOOST_STATIC_ASSERT(boost::is_array<arr>::value);
(sizeof(arr)/sizeof(arr[0]))

?
Philippe

p.s: not sure it actually works, just throwing ideas


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