|
Boost : |
Subject: Re: [boost] How to get the size of an C-array?
From: Sid Sacek (ssacek_at_[hidden])
Date: 2009-10-14 18:18:05
I'm going to take a guess. Of course, this is all contingent on whether T is a class that contains a destructor, otherwise all bets are off.
-Sid Sacek
struct XYZ { int i; };
struct T
{
XYZ xyz;
~T() {}
};
void foo( void )
{
T * tp = new T[ 100 ];
size_t array_size = reinterpret_cast< size_t * >( tp )[ -1 ];
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk