Boost logo

Boost :

From: Ullrich Koethe (koethe_at_[hidden])
Date: 2001-03-29 16:00:07


Jeremy Siek wrote:
>
> On Thu, 29 Mar 2001, Ullrich Koethe wrote:
>
> koethe> Basic Vector
> koethe>
> koethe> x[i] vector_traits<X>::reference
> koethe>
> koethe> The requirement that basic_vector::operator[] returns an lvalue has
>
> The Basic Vector concept as written does not require an lvalue return
> type.
>
> x[i] vector_traits<X>::reference, which must be a type convertible
> to the value type.
> x[i] = a undefined return type
>
> because nowhere did I say that vector_traits<X>::reference must be an
> lvalue. I just said it needed to be convertible to the value type. If I
> had made it an lvalue, then I wouldn't have needed to require the second
> expression "x[i] = a".
>

Sorry, I was unclear. I meant to say that I want

   x[i] = a

replaced with

   x.set(i,a)

because this is so much more flexible (with only a minor loss in
readability, e.g.

magnitude.set(i, sqrt(x[i]*x[i] + y[i]*y[i]))

(of course, there are hacks to make x[i] = a work when x[i] is a
computed attribute, but they are really just hacks)

-- 
 ________________________________________________________________
|                                                                |
| Ullrich Koethe  Universität Hamburg / University of Hamburg    |
|                 FB Informatik / Dept. of Computer Science      |
|                 AB Kognitive Systeme / Cognitive Systems Group |
|                                                                |
| Phone: +49 (0)40 42883-2573                Vogt-Koelln-Str. 30 |
| Fax:   +49 (0)40 42883-2572                D - 22527 Hamburg   |
| Email: u.koethe_at_[hidden]               Germany             |
|        koethe_at_[hidden]                        |
| WWW:   http://kogs-www.informatik.uni-hamburg.de/~koethe/      |
|________________________________________________________________|

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