1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:37:46 +00:00

LibCore: Invoke forward from the global namespace inside C_OBJECT

If a class defines a method named `forward` itself, the compiler isn't
able to differentiate between that method and (std::)forward.
This commit is contained in:
Timothy Flynn 2022-11-14 10:38:36 -05:00 committed by Tim Flynn
parent fb83ceaf57
commit b00d77eac8

View file

@ -65,18 +65,18 @@ enum class TimerShouldFireWhenNotVisible {
Yes Yes
}; };
#define C_OBJECT(klass) \ #define C_OBJECT(klass) \
public: \ public: \
virtual StringView class_name() const override { return #klass##sv; } \ virtual StringView class_name() const override { return #klass##sv; } \
template<typename Klass = klass, class... Args> \ template<typename Klass = klass, class... Args> \
static NonnullRefPtr<klass> construct(Args&&... args) \ static NonnullRefPtr<klass> construct(Args&&... args) \
{ \ { \
return adopt_ref(*new Klass(forward<Args>(args)...)); \ return adopt_ref(*new Klass(::forward<Args>(args)...)); \
} \ } \
template<typename Klass = klass, class... Args> \ template<typename Klass = klass, class... Args> \
static ErrorOr<NonnullRefPtr<klass>> try_create(Args&&... args) \ static ErrorOr<NonnullRefPtr<klass>> try_create(Args&&... args) \
{ \ { \
return adopt_nonnull_ref_or_enomem(new (nothrow) Klass(forward<Args>(args)...)); \ return adopt_nonnull_ref_or_enomem(new (nothrow) Klass(::forward<Args>(args)...)); \
} }
#define C_OBJECT_ABSTRACT(klass) \ #define C_OBJECT_ABSTRACT(klass) \