Jan 11, 2016

[C++17] adding a const: std::as_const

cppref std::as_const


Defined in header
template constexpr std::add_const_t& as_const(T& t) noexcept; (1) (since C++17) 
template void as_const(const T&&) = delete; (2) (since C++17) 

1) Forms lvalue reference to const type of t 
2) const rvalue reference overload is deleted to disallow rvalue arguments

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.