
2 Mar
2004
2 Mar
'04
7 a.m.
"Roland Richter" <roland@flll.jku.at> wrote in message news:40432D65.2080806@flll.jku.at...
Boosters,
I want to write a function which compares two shared_array's element-wise (operator==() compares for pointer equality).
How to get the number of elements a given shared_array contains? At first glance there seems to be no possibility; am I missing something?
shared_array helps you manage the lifetime of a dynamically allocated array. With shared_array, just as with raw dynamically allocated arrays, you must keep track of the size yourself. If you look at the shared_array constructors, you'll see there's no way for it to know the array's size. You can always use a shared_ptr to a vector if you need to be able to query the size. Jonathan