Some classes use X4Movable to show human-friendly errors but in return the current implementation of X4Movable is not SFINAE-friendly in certain scenario.
Generically speaking, any concept should be SFINAE-friendly. We should fix X4Movable while keeping human-friendly errors in all usages.
The overload below should ideally be = delete("with reason"); but it's not implemented in C++23. How can we solve this issue?
|
template<traits::NonUnusedAttr T> |
|
constexpr void move_to(T&, T&) noexcept |
|
{ |
|
static_assert( |
|
!std::is_const_v<T>, |
|
"`x4::move_to(T const&, T const&)` is not allowed" |
|
); |
|
|
|
static_assert( |
|
false, |
|
"lvalue reference detected on the `src` argument of `x4::move_to`. " |
|
"The caller is definitely lacking `std::move` or `std::forward`. If you " |
|
"intend to *copy* the mutable value, apply `x4::move_to(std::as_const(attr_), attr)`." |
|
); |
|
// Banned: possible, but bug-prone. |
|
// dest = std::move(src); |
|
} |
Some classes use
X4Movableto show human-friendly errors but in return the current implementation ofX4Movableis not SFINAE-friendly in certain scenario.Generically speaking, any concept should be SFINAE-friendly. We should fix
X4Movablewhile keeping human-friendly errors in all usages.The overload below should ideally be
= delete("with reason");but it's not implemented in C++23. How can we solve this issue?x4/include/iris/x4/core/move_to.hpp
Lines 68 to 84 in e811b03