Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2006-11-30 07:02:41

On Thursday 30 November 2006 10:52, Michael Stevens wrote:
> Just took a look at this. Throughout 'vector_expression.hpp' we have
> following:
> class const_iterator;
> typedef const_iterator iterator;
> const_iterator begin () const;
> const_iterator end () const;
> // Reverse iterator
> typedef reverse_iterator_base<const_iterator>
> const_reverse_iterator; const_reverse_iterator rbegin () const;
> const_reverse_iterator rend () const;
> So we have a const_reverse_iterator but no reverse_iterator. I am thinking
> it may be better to change 'Vector Expression'. Mutable 'Vector
> Expression's are 'Vector Container'. So the latter would be the place to
> require the non const iterators.

The question is whether a vector_range (vector_slice) is a model of Vector
Expression or Vector Container. I would prefer to have 2 Models: the "Vector
Expression" which defines the read only interface and the "Vector Container"
which refines "Vector Expression" by adding the mutable interface.

Is this possible?

I think, this would imply to have "const vector_expression<E>&" in every
function's argument list. Can we make vector_expression non-copyable (it is
already non-assignable?
Another implication would be a modification of vector_reference (which is
derived from vector_expression, but models a mutable "Vector Container") and
we could drop a lot of lines in vector_expression.hpp. (Why is, e.g.,
vector_unary assignable? I found only one application: the definition of a
mutable trans(v). Who needs this?)