Boost logo

Boost :

Subject: [boost] [utility] declval addition? [type_traits] add_rvalue_reference addition?
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-08-14 09:42:54


Hi,

I was wondering if we can add the declval utility function template to the Boost.Utility library

20.3.4 Function template declval [declval]

1 The library provides the function template declval to simplify the definition of expressions which occur as

unevaluated operands (Clause 5).

template <class T>

typename add_rvalue_reference<T>::type declval() noexcept; // as unevaluated operand

2 Remarks: If this function is used (as defined by (3.2)), the program is ill-formed.

3 Remarks: The template parameter T of declval may be an incomplete type.

[ Example:

template <class To, class From>

decltype(static_cast<To>(declval<From>())) convert(From&&);

declares a function template convert which only participats in overloading if the type From can be

explicitly converted to type To. For another example see class template common_type (20.7.6.6). -end

example ]

BTW, add_rvalue_reference is not available on Boost.TypeTraits, add_rvalue_reference_layer. Any problem to add it?

Best,

_____________________
Vicente Juan Botet Escribá
http://viboes.blogspot.com/


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