Re: [boost] [utility] Adding noexcept to boost::declval

Vicente J. Botet Escriba wrote
Summary: Defining declval<T>() as add_lvalue_reference<T>::type is wrong; add_lvalue_reference should be removed!
There is something that disturb me by returning just T, doesn't this forces the type T to CopyConstructible?
Nope. T needs not to be CopyConstructible (Note that declval can be used only in unevaluated contexts.)
The idea to use T& instead was to avoid this.
You shouldn't do this, because this transforms rvalues to lvalues.
I have rolled back at revision 77562.
Thanks, Vicente! Minor issue: `#include <boost/type_traits/add_lvalue_reference.hpp>` is not removed yet. Regards, Michel

AMDG On 03/26/2012 06:19 PM, Michel Morin wrote:
Vicente J. Botet Escriba wrote
Summary: Defining declval<T>() as add_lvalue_reference<T>::type is wrong; add_lvalue_reference should be removed!
There is something that disturb me by returning just T, doesn't this forces the type T to CopyConstructible?
Nope. T needs not to be CopyConstructible (Note that declval can be used only in unevaluated contexts.)
Even if it doesn't have to be CopyConstructible, it still can't be an abstract class. On the other hand, maybe that's okay, since in C++03, there's no way to create an rvalue of an abstract class.
The idea to use T& instead was to avoid this.
You shouldn't do this, because this transforms rvalues to lvalues.
I have rolled back at revision 77562.
Thanks, Vicente! Minor issue: `#include <boost/type_traits/add_lvalue_reference.hpp>` is not removed yet.
In Christ, Steven Watanabe
participants (2)
-
Michel Morin
-
Steven Watanabe