Subject: Re: [boost] Formal review request: static size matrix/vector linear algebra library (Boost) LA
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2010-02-10 19:37:42
El 09/02/2010 03:45 a.m., Emil Dotchevski escribió:
> 2010/2/8 Agustín K-ballo Bergé <kaballo86_at_[hidden]>:
>> boost::la::la_detail::vref_< T > get( int index )
>> return boost::la::vref( ... );
> I was actually interested in the ... part :)
It's merely an expression that returns a T(&)[N].
> Why isn't it plausible for you to do:
> my_own_conforming_vector_type get( int index )
I want to return a conforming vector type, and whatever vref returns
fills the bill perfectly. My project is a generic OpenGL model,
specialized by a sequence of attributes that describe a vertex.
>> In my current project I use the library to generically work with any
>> conforming vertex type, so I can't use the subscript operator since it
>> would be optional. That's why I propose adding support for subscript
>> operator via vref/mref. vref/mref would wrap the UDTs and implement the
>> subscript operators, similar to what they currently do for arrays.
> However, all this presumes that op| doesn't work well. The only
> potential issue with it is the low precedence. Is that why you'd
> rather use op[ ]?
I have been bitten by the precedence issue to the point I enclose every
pipe operation in parenthesis. And it gets worse if "complex swizzling
expressions" are added to the library. Consider
( v1 | ( Y, -X ) ) * 2;
v1[ Y, -X ] * 2;
It *might* be possible to get ride of the precedence problems by using
expression templates, but even then subscripting operator seems more
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk