tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
move.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_MOVE_HPP
5#define TETL_UTILITY_MOVE_HPP
6
7#include <etl/_type_traits/remove_reference.hpp>
8
9namespace etl {
10
11/// \brief move is used to indicate that an object t may be "moved from",
12/// i.e. allowing the efficient transfer of resources from t to another object.
13/// In particular, move produces an xvalue expression that identifies its
14/// argument t. It is exactly equivalent to a static_cast to an rvalue reference
15/// type.
16///
17/// \returns `static_cast<remove_reference_t<T>&&>(t)`
18template <typename T>
19constexpr auto move(T&& t) noexcept -> etl::remove_reference_t<T>&&
20{
21 return static_cast<etl::remove_reference_t<T>&&>(t);
22}
23
24} // namespace etl
25
26#endif // TETL_UTILITY_MOVE_HPP
Definition adjacent_find.hpp:9
constexpr auto move(T &&t) noexcept -> etl::remove_reference_t< T > &&
move is used to indicate that an object t may be "moved from", i.e. allowing the efficient transfer o...
Definition move.hpp:19