Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2003-12-03 17:43:57


"Douglas Paul Gregor" <gregod_at_[hidden]> wrote in message
news:20031203132418.C2024_at_ashley.cs.rpi.edu...
> [...]
> Well, arrays are just not _objects_ like all of the STL containers.
> They don't have begin()/end() to get iterators, they don't have a
> size() member function, or a value_type typedef, and can't be
> copied around like objects can. The lib plays nice with arrays,
> but arrays don't want to join in the fun.
> [...]

On the other hand, I'm not sure how to use an initializer list
with a non-array container. I have a fair amount of code that
uses local const data like so:

void foo()
{
    my_data const d[] = {a, b, c, d};
    ...
    my_data const* end = d + dimension(d);
    for (my_data const* p = d; p != end; ++p)
    {
        ...
    }
}

Obviously, I use the sizeof idiom instead, but it would be a lot
nicer to use the size/dimension trick instead. Is it possible to
use a user-defined container instead? Even if it is, would it
be preferred for this kind of use-case?

Dave

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.544 / Virus Database: 338 - Release Date: 11/25/2003

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