|
Boost : |
Subject: Re: [boost] [LA] vector_traits for setters
From: Emil Dotchevski (emil_at_[hidden])
Date: 2010-05-13 03:06:28
On Mon, May 10, 2010 at 12:58 PM, Daniel Pfeifer <daniel_at_[hidden]> wrote:
> Hi Emil and others,
>
> Qt 4.6 brought support for some vector and matrix types.
>
> While it is easy to define matrix_traits for QGenericMatrix and
> QMatrix4x4, i am struggling with the vector_traits for QVector2D,
> QVector3D and QVector4D.
>
> The problem is that Qt's vector types have setters and no
> non-const-ref getters.
>
> Is there a plan for (Boost).LA to support types with setters?
I started converting to setters and hit a problem I don't have a good
solution to.
(Boost)LA uses operator| overloads to bind vector and matrix type
(elements). For example, for an object v of any vector type you could
say:
v|row_matrix
and it returns a reference to v itself of type that makes it look like
a row-matrix. Importantly, this reference is not read-only.
Similarly, you could say
v|X
and it returns a reference to the X element of v. Naturally, you could do:
v|X *= 2;
to multiply the X coordinate of v by 2.
This syntax depends on the vector_traits type to return a mutable
reference to a vector's element. This won't work with setters.
Ideas?
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk