1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:57:35 +00:00

Checked: constexpr support

Problem:
- `Checked` is not `constexpr`-aware.

Solution:
- Decorate member functions with `constexpr` keyword.
- Add tests to ensure the functionality where possible.
This commit is contained in:
Lenny Maiorani 2020-10-19 12:30:30 -04:00 committed by Andreas Kling
parent bd99083436
commit a40abd6ce3
3 changed files with 312 additions and 43 deletions

View file

@ -82,7 +82,7 @@ inline constexpr T ceil_div(T a, U b)
# pragma clang diagnostic ignored "-Wconsumed"
#endif
template<typename T>
inline T&& move(T& arg)
constexpr T&& move(T& arg)
{
return static_cast<T&&>(arg);
}
@ -433,7 +433,7 @@ struct IsConst<const T> : TrueType {
};
template<typename T, typename U = T>
inline constexpr T exchange(T& slot, U&& value)
constexpr T exchange(T& slot, U&& value)
{
T old_value = move(slot);
slot = forward<U>(value);