Boost logo

Boost :

Subject: Re: [boost] Temporary objects
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2009-11-02 15:08:06


DE wrote:
> Mathias Gaunard wrote:
> > Boost.Move is actually fairly similar to what you are proposing.
> well, to this point i still think that a temporary<type> better
> reflects the underlying semantics than, i guess, BOOST_RV_REF(type) (looks extremely ugly)

Boost.Move is really similar to what you are proposing, but it also handles the case that the compiler actually supports rvalue-references. So BOOST_RV_REF is a macro defined as:

#ifdef BOOST_HAS_RVALUE_REFS
  #define BOOST_RV_REF(TYPE) TYPE &&
#else
  #define BOOST_RV_REF(TYPE) boost::rv< TYPE >&
#endif

It is true that macros always look ugly, but this is exactly the situation where you have to use a macro to abstract away unavoidable language differences.

Regards,
Thomas


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