From c3fec2466ed44e3d65b8dceb5a80bc621176d45d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 7 Apr 2024 00:20:13 +0200 Subject: b --- compat/overloaded.hpp | 8 ++++++++ editor/inspect-types.cpp | 4 +--- serialize/scenery.cpp | 1 + src/scenery.cpp | 15 --------------- src/scenery.hpp | 3 --- 5 files changed, 10 insertions(+), 21 deletions(-) create mode 100644 compat/overloaded.hpp diff --git a/compat/overloaded.hpp b/compat/overloaded.hpp new file mode 100644 index 00000000..77cfc9dc --- /dev/null +++ b/compat/overloaded.hpp @@ -0,0 +1,8 @@ +#pragma once + +namespace floormat { + +template struct overloaded : Ts... { using Ts::operator()...; }; +template overloaded(Ts...) -> overloaded; + +} // namespace floormat diff --git a/editor/inspect-types.cpp b/editor/inspect-types.cpp index 899bc851..331b82a7 100644 --- a/editor/inspect-types.cpp +++ b/editor/inspect-types.cpp @@ -1,5 +1,6 @@ #include "entity/metadata.hpp" #include "entity/accessor.hpp" +#include "compat/overloaded.hpp" #include "src/scenery.hpp" #include "src/anim-atlas.hpp" #include "src/tile-defs.hpp" @@ -90,9 +91,6 @@ struct entity_accessors { } }; -template struct overloaded : Ts... { using Ts::operator()...; }; -template overloaded(Ts...) -> overloaded; - template<> struct entity_accessors { static constexpr auto accessors() diff --git a/serialize/scenery.cpp b/serialize/scenery.cpp index 80f99d32..080d0f71 100644 --- a/serialize/scenery.cpp +++ b/serialize/scenery.cpp @@ -1,4 +1,5 @@ #include "scenery.hpp" +#include "compat/overloaded.hpp" #include "compat/exception.hpp" #include "src/anim-atlas.hpp" #include "compat/assert.hpp" diff --git a/src/scenery.cpp b/src/scenery.cpp index fb3010f1..c5575f6a 100644 --- a/src/scenery.cpp +++ b/src/scenery.cpp @@ -13,21 +13,6 @@ namespace floormat { namespace { -template struct [[maybe_unused]] overloaded : Ts... { using Ts::operator()...; }; - -#if defined __GNUG__ && !defined __clang__ -#pragma GCC diagnostic push // gcc doesn't support [[attributes]] on deduction guides -#pragma GCC diagnostic ignored "-Wunused" -#endif -template -#ifdef __clang__ -[[maybe_unused]] -#endif -overloaded(Ts...) -> overloaded; -#if defined __GNUG__ && !defined __clang__ -#pragma GCC diagnostic pop -#endif - template struct proto_to_scenery_; template<> struct proto_to_scenery_ { using type = generic_scenery; }; template<> struct proto_to_scenery_ { using type = door_scenery; }; diff --git a/src/scenery.hpp b/src/scenery.hpp index cc728a4b..e668f7a2 100644 --- a/src/scenery.hpp +++ b/src/scenery.hpp @@ -11,9 +11,6 @@ namespace floormat { -template struct [[maybe_unused]] overloaded : Ts... { using Ts::operator()...; }; -template overloaded(Ts...) -> overloaded; - class chunk; class anim_atlas; class world; -- cgit v1.2.3