Boost logo

Boost :

Subject: Re: [boost] [operators] The future of Boost.Operators
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2013-04-24 13:04:33


On Tue, Apr 23, 2013 at 11:06 PM, Andrew Ho <helloworld922_at_[hidden]> wrote:

> Here's a thought about the direct use of r-value references vs. pass by
> value
> argument:
>
> We are planning on providing a version which is supposed to support
> compilers
> without move semantics. However, these implementations are close to,
> perhaps
> even exactly identical to the code that would take advantage of move
> semantics
> via pass by value.
>
> Say we allowed a user-accessible define which would allow the programmer to
> decide?
>

A macro which globally switches the effect of all uses of Boost.Operators?
Let's avoid that.

something like:
>
> // BOOST_HAS_RVALUE_REFS is a feature availability check
> // BOOST_UNSAFE_MOVE is user-definable override to use faster, unsafe
> version
> #if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_UNSAFE_MOVE)
> // use 4 overload version
> #else
> // use pass-by-value version
> #endif
>
> If the user is more concerned with safety over micro-optimizations, the
> default behavior would resort to pass by value (good for backwards
> compatibility).
>

Remind me how the 4-overload-version is unsafe, again?

However, the user would have the option available to easily use the faster
> version if they deem it necessary.
>

- Jeff


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