Skip to content

Commit

Permalink
Make cpp2::move constexpr (hsutter#1106)
Browse files Browse the repository at this point in the history
* cpp2::move is now constexpr

* Add `inline` too

---------

Co-authored-by: Herb Sutter <herb.sutter@gmail.com>
  • Loading branch information
bluetarpmedia and hsutter authored Jun 13, 2024
1 parent 60bfbb6 commit 963f06f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/cpp2util.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,13 +485,13 @@ concept valid_custom_is_operator = predicate_member_fun<X, F, &F::op_is>

template <typename T>
requires (std::is_copy_constructible_v<std::remove_cvref_t<T>>)
auto move(T&& t) -> decltype(auto) {
inline constexpr auto move(T&& t) -> decltype(auto) {
return std::move(t);
}

template <typename T>
requires (!std::is_copy_constructible_v<std::remove_cvref_t<T>>)
auto move(T&& t) -> decltype(auto) {
inline constexpr auto move(T&& t) -> decltype(auto) {
return std::forward<T>(t);
}

Expand Down

0 comments on commit 963f06f

Please sign in to comment.