Boost logo

Boost :

Subject: Re: [boost] [utility] rvalue support in value_initialized
From: Niels Dekker - address until 2014 (niels_dekker_address_until_2014_at_[hidden])
Date: 2011-09-19 13:13:37


> +#ifndef BOOST_NO_RVALUE_REFERENCES
> +
> template<class T>
> +T&& get ( value_initialized<T>&& x )
> +{
> + return std::move(x.data()) ;
> +}
...
> +#endif

Mathias Gaunard wrote:
> Note however that it assumes that if BOOST_NO_RVALUE_REFERENCES is not
> set, then you have std::move in <utility>, which isn't the case with
> certain compilers.

In order to avoid such a dependency on <utility>, I would suggest to do
static_cast<T&&>(x.data()), instead of std::move(x.data()).

My two cents, Niels

--
Niels Dekker
http://www.xs4all.nl/~nd/dekkerware
Scientific programmer at LKEB, Leiden University Medical Center

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