Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-06-27 17:19:40

Peter Dimov writes:
> > - I agree that an enum for N should be provided, and that
> > static_size is probably the best name yet.
> I wonder in what situations would a static_size be useful.
> If you know that you are dealing with array, you'd write
> template<class T, size_t N> void f(array<T, N>& a);
> On the other hand, if you don't know that the container you are dealing with
> is an array, you wouldn't be able to use static_size - no other container
> has such a member.

Good point, but we need to look to the future! Setting a precedent for
future array-like classes is a good thing. For example, future
versions of MTL will include such classes.

> > - swap (if it is to be provided) should use std::swap_ranges.
> >
> > - operator== should use std::equal.
> >
> > - operator< should use std::lexicographical_compare.
> When I implemented my own array class, I found that the explicit loops
> generated better code than the standard algorithms. This would probably
> change in the future.

The right thing to do here is not to write explicit loops, but to
complain to your compiler vendor (and it helps to send them examples).



Boost list run by bdawes at, gregod at, cpdaniel at, john at