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
// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4
#
ifndef
TETL_UTILITY_AS_CONST_HPP
5
#
define
TETL_UTILITY_AS_CONST_HPP
6
7
#
include
<
etl
/
_type_traits
/
add_const
.
hpp
>
8
9
namespace
etl
{
10
11
/// \brief Forms lvalue reference to const type of t.
12
template
<
typename
T>
13
[[nodiscard]]
constexpr
auto
as_const
(T& t)
noexcept
-> add_const_t<T>&
14
{
15
return
t;
// NOLINT(bugprone-return-const-ref-from-parameter)
16
}
17
18
template
<
typename
T>
19
constexpr
auto
as_const
(T
const
&&) ->
void
=
delete
;
20
21
}
// namespace etl
22
23
#
endif
// TETL_UTILITY_AS_CONST_HPP
etl
Definition
adjacent_find.hpp:9
etl::as_const
constexpr auto as_const(T &t) noexcept -> add_const_t< T > &
Forms lvalue reference to const type of t.
Definition
as_const.hpp:13
etl::as_const
constexpr auto as_const(T const &&) -> void=delete
include
etl
_utility
as_const.hpp
Generated on Sun Sep 7 2025 19:15:18 for tetl by
1.9.8