4 Aug
2005
4 Aug
'05
3:28 a.m.
On 03/08/05, gast128
Dear all,
I was wondering why boost::array did not offer compile time checked access to its contents, something like a.get<1>(), a similar interface like tuple. Otherwise I see not much enhancement compared to an ordinary std::vector.
Wkr, me
boost::array is allocated on the stack like a normal array, while a std::vector needs to use an allocator, usually putting it on the heap. Also, the normal usage pattern for arrays ( dynamic or otherwise ) is looping through them, the accesses in which cannot be compile-time checked. Note, however, that operator[] does assert that the index is valid--which quickly caught me a bug a little while back. - Scott McMurray