From 74be88f5d0d1d95f84d8ee140e5c035b9a710a48 Mon Sep 17 00:00:00 2001 From: nieznanysprawiciel Date: Sat, 12 Oct 2024 23:45:36 +0200 Subject: [PATCH] Fix compliation of TestSWMaterialSaver DirectX operator== --- swCommonLib/Common/Macros/GenerateOperators.h | 11 ++++++----- .../Tests/TestMaterial/TestSWMaterialSaver.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/swCommonLib/Common/Macros/GenerateOperators.h b/swCommonLib/Common/Macros/GenerateOperators.h index 03372b84..dc0d9087 100644 --- a/swCommonLib/Common/Macros/GenerateOperators.h +++ b/swCommonLib/Common/Macros/GenerateOperators.h @@ -17,11 +17,12 @@ namespace sw #define _APPEND_INSTANCE_OBJ2( member ) _APPEND_INSTANCE( obj2, member ) #define _GENERATE_OPERATOR( OP, ClassType, ... ) \ -inline bool operator##OP( const ClassType& obj1, const ClassType& obj2 )\ -{ \ - return std::tie( FOR_EACH( _APPEND_INSTANCE_OBJ1, __VA_ARGS__ ) ) \ - OP std::tie( FOR_EACH( _APPEND_INSTANCE_OBJ2, __VA_ARGS__ ) ); \ -} +inline static bool operator##OP( const ClassType& obj1, const ClassType& obj2 ) \ +{ \ + return std::tie( FOR_EACH( _APPEND_INSTANCE_OBJ1, __VA_ARGS__ ) ) \ + OP std::tie( FOR_EACH( _APPEND_INSTANCE_OBJ2, __VA_ARGS__ ) ); \ +} \ + /**@brief Generates operator== function for ClassType. Pass all class members as variadic parameters.*/ diff --git a/swGraphicAPI/Tests/TestMaterial/TestSWMaterialSaver.cpp b/swGraphicAPI/Tests/TestMaterial/TestSWMaterialSaver.cpp index fb1cc4af..26ba5ff0 100644 --- a/swGraphicAPI/Tests/TestMaterial/TestSWMaterialSaver.cpp +++ b/swGraphicAPI/Tests/TestMaterial/TestSWMaterialSaver.cpp @@ -27,8 +27,10 @@ using namespace sw; // Material test utils //====================================================================================// -GENERATE_RELATIONAL_OPERATORS( DirectX::XMFLOAT3, x, y, z ); -GENERATE_RELATIONAL_OPERATORS( DirectX::XMFLOAT4, x, y, z, w ); +namespace DirectX { + GENERATE_RELATIONAL_OPERATORS(DirectX::XMFLOAT3, x, y, z); + GENERATE_RELATIONAL_OPERATORS(DirectX::XMFLOAT4, x, y, z, w); +} // ================================ //