tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
identity.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_FUNCTIONAL_IDENTITY_HPP
5#define TETL_FUNCTIONAL_IDENTITY_HPP
6
7#include <etl/_utility/forward.hpp>
8
9namespace etl {
10
11/// \brief etl::identity is a function object type whose operator() returns its
12/// argument unchanged.
13struct identity {
14 using is_transparent = void;
15
16 template <typename T>
17 [[nodiscard]] constexpr auto operator()(T&& t) const noexcept -> T&&
18 {
19 return etl::forward<T>(t);
20 }
21};
22
23} // namespace etl
24
25#endif // TETL_FUNCTIONAL_IDENTITY_HPP
Definition adjacent_find.hpp:9
etl::identity is a function object type whose operator() returns its argument unchanged.
Definition identity.hpp:13
constexpr auto operator()(T &&t) const noexcept -> T &&
Definition identity.hpp:17