std::as_const (3) - Linux Manuals
std::as_const: std::as_const
NAME
Synopsis
Defined in header <utility>
template <class T> (1) (since C++17)
constexpr std::add_const_t<T>& as_const(T& t) noexcept;
template <class T> (2) (since C++17)
void as_const(const T&&) = delete;
1) Forms lvalue reference to const type of t
2) const rvalue reference overload is deleted to disallow rvalue arguments
Possible implementation
Example
// Run this code
See also
is_const checks if a type is const-qualified
(C++11)
add_cv
add_const
add_volatile adds const or/and volatile specifiers to the given type
(C++11)
(C++11)
(C++11)
remove_cv
remove_const
remove_volatile removes const or/and volatile specifiers from the given type
(C++11)
(C++11)
(C++11)