Boost logo

Boost :

Subject: Re: [boost] Formal review request: static size matrix/vector linear algebra library (Boost) LA
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2010-02-09 01:45:20


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 :)

Why isn't it plausible for you to do:

my_own_conforming_vector_type get( int index )
{
  ...
}

For example:

struct vertex
{
  float pos[3];
  float normal[3];
};

float (&get_pos(int index))[3]
{
  return verts[index].pos;
}

> 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[ ]?

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