Boost logo

Boost :

Subject: Re: [boost] Formal review for QVM
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2015-12-14 17:57:14


On Mon, Dec 14, 2015 at 1:12 PM, Agustín K-ballo Bergé <
kaballo86_at_[hidden]> wrote:

> On 12/14/2015 5:53 PM, Emil Dotchevski wrote:
>
>> On Mon, Dec 14, 2015 at 4:46 AM, Agustín K-ballo Bergé <
>>
> if the compiler says there is an error here because `normalized` needs a
>>> default constructor, I'm gonna start suspecting something wrong is going
>>> on
>>> with the library. This is what I would naively expect `normalized` to be
>>> doing:
>>>
>>> template <typename Vec>
>>> Vec normalized(Vec v) {
>>> return v /= length(v);
>>> }
>>>
>>
>> It can't be implemented that way because the type of the argument might
>> not
>> be copyable.
>>
>
> Does this mean that the library explicitly supports movable-only types?
> That's somewhat unexpected, given that the library requires all type
> information necessary for embedded storage, but it's not a bad thing. It
> would be good to add this information to the reference documentation.

QVM is neutral wrt move semantics but views are non-copyable and
non-movable because copy or move semantics would require a temporary
object, which QVM views are carefully designed to avoid. You can assign to
a view and it will convert to any compatible type, but you can't copy or
move it. That's why you can chain views up with no overhead: any operation
on a view or multiple chained views works with the original object, no
other objects are created.

Emil


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