Boost logo

Boost :

Subject: Re: [boost] Review Request: QVM (generic Quaternion, Vector and Matrix operations library)
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2015-05-06 21:32:35


2015-05-07 2:25 GMT+02:00 Emil Dotchevski <emildotchevski_at_[hidden]>:

>
> Q: Why doesn't QVM use [] or () to access vector and matrix elements?
>
> A: Because it's designed to work with user-defined types, and the C++
> standard requires these operators to be members. Of course if a
> user-defined type defines operator[] or operator() they are available for
> use with other QVM functions, but the generic access defined by QVM uses
> operator% instead.
>
>
Emil, correct me if I'm wrong.
For higher dimensions the user would be forced to use traits explicitly:

qvm::v_traits<vec_t>::r<I>(vec);
qvm::m_traits<mat_t>::r<R, C>(mat);

It'd also probably be possible to add a free function get, now or later if
the users requested it:

qvm::get<I>(vec);
qvm::get<R, C>(mat);

There are std::get, boost::get and boost::geometry::get serving similar
purpose so it should be intuitive.

Regards,
Adam


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