Boost logo

Boost :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2008-04-29 11:21:51


Thorsten Ottosen wrote:
> Hi Ion,
>
> Sometimes I need to go through all elements in such a container.
> However, it is know that the number of elements is low, so I unroll the
> loop manually. In that case I would like to be able to do the following:
>
> const T& t1 = flat_set[0u];
> const T& t2 = flat_set[1u];
>
> Alternatively, provide a base() function that directly give read access
> to the underlying container:
>
> const T& t1 = flat_set.base()[0u];
>
> Comments?

I don't see any problem to provide it. I don't like much "base()" name,
naybe I should rename the function to internal_container() or something
similar.

Anyway, are not internal random-access iterators good enough?

flat_set_type::iterator itbeg = flat_set.begin();
const T& t1 = itbeg[0];
const T& t2 = itbeg[1];

Regards,

Ion

>
> -Thorsten
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


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