mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:14:58 +00:00
AK: Fix build with !USING_AK_GLOBALLY
A couple headers expected names to be in the global namespace, qualify those names to make sure they're resolved even when the names are not exported. One header placed its functions in the global namespace, move those to the AK namespace to make the concepts resolve.
This commit is contained in:
parent
483c18437b
commit
ad120606fd
3 changed files with 32 additions and 4 deletions
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include <AK/Assertions.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
template<typename T, typename U>
|
||||
constexpr auto round_up_to_power_of_two(T value, U power_of_two)
|
||||
requires(AK::Detail::IsIntegral<T> && AK::Detail::IsIntegral<U>)
|
||||
|
@ -30,21 +32,23 @@ requires(AK::Detail::IsIntegral<T>)
|
|||
return value && !((value) & (value - 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifndef AK_DONT_REPLACE_STD
|
||||
namespace std { // NOLINT(cert-dcl58-cpp) Names in std to aid tools
|
||||
|
||||
// NOTE: These are in the "std" namespace since some compilers and static analyzers rely on it.
|
||||
|
||||
template<typename T>
|
||||
constexpr T&& forward(RemoveReference<T>& param)
|
||||
constexpr T&& forward(AK::Detail::RemoveReference<T>& param)
|
||||
{
|
||||
return static_cast<T&&>(param);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr T&& forward(RemoveReference<T>&& param) noexcept
|
||||
constexpr T&& forward(AK::Detail::RemoveReference<T>&& param) noexcept
|
||||
{
|
||||
static_assert(!IsLvalueReference<T>, "Can't forward an rvalue as an lvalue.");
|
||||
static_assert(!AK::Detail::IsLvalueReference<T>, "Can't forward an rvalue as an lvalue.");
|
||||
return static_cast<T&&>(param);
|
||||
}
|
||||
|
||||
|
@ -59,9 +63,17 @@ constexpr T&& move(T& arg)
|
|||
# include <utility>
|
||||
#endif
|
||||
|
||||
#if !USING_AK_GLOBALLY
|
||||
namespace AK {
|
||||
#endif
|
||||
|
||||
using std::forward;
|
||||
using std::move;
|
||||
|
||||
#if !USING_AK_GLOBALLY
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace AK::Detail {
|
||||
template<typename T>
|
||||
struct _RawPtr {
|
||||
|
@ -182,10 +194,12 @@ using AK::ceil_div;
|
|||
using AK::clamp;
|
||||
using AK::exchange;
|
||||
using AK::is_constant_evaluated;
|
||||
using AK::is_power_of_two;
|
||||
using AK::max;
|
||||
using AK::min;
|
||||
using AK::mix;
|
||||
using AK::RawPtr;
|
||||
using AK::round_up_to_power_of_two;
|
||||
using AK::swap;
|
||||
using AK::to_underlying;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue