diff options
author | Lenny Maiorani <lenny@colorado.edu> | 2020-10-19 12:30:30 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-10-20 16:31:24 +0200 |
commit | a40abd6ce3a032b1baf52c3573ff02ad658c6e91 (patch) | |
tree | d632ac43153598b3fadb515ff9724c4574d03da5 /AK/StdLibExtras.h | |
parent | bd99083436f313d8105cf7ba489f594e49e9e625 (diff) | |
download | serenity-a40abd6ce3a032b1baf52c3573ff02ad658c6e91.zip |
Checked: constexpr support
Problem:
- `Checked` is not `constexpr`-aware.
Solution:
- Decorate member functions with `constexpr` keyword.
- Add tests to ensure the functionality where possible.
Diffstat (limited to 'AK/StdLibExtras.h')
-rw-r--r-- | AK/StdLibExtras.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/AK/StdLibExtras.h b/AK/StdLibExtras.h index e8e02703ee..02032ea1e2 100644 --- a/AK/StdLibExtras.h +++ b/AK/StdLibExtras.h @@ -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); |