tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
as_const.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_UTILITY_AS_CONST_HPP
4#define TETL_UTILITY_AS_CONST_HPP
5
7
8namespace etl {
9
11template <typename T>
12[[nodiscard]] constexpr auto as_const(T& t) noexcept -> add_const_t<T>&
13{
14 return t; // NOLINT(bugprone-return-const-ref-from-parameter)
15}
16
17template <typename T>
18constexpr auto as_const(T const&&) -> void = delete;
19
20} // namespace etl
21
22#endif // TETL_UTILITY_AS_CONST_HPP
Definition adjacent_find.hpp:8
constexpr auto as_const(T &t) noexcept -> add_const_t< T > &
Forms lvalue reference to const type of t.
Definition as_const.hpp:12