From 3dd8d5de9119c68952def42d6648dd4278fb441b Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 19 Mar 2023 17:01:26 -0700 Subject: [PATCH] get rid of EXV_CALL_MEMBER_FN std::invoke can be used. Signed-off-by: Rosen Penev --- include/exiv2/types.hpp | 11 ----------- src/convert.cpp | 5 +++-- src/tiffvisitor_int.cpp | 5 +++-- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/include/exiv2/types.hpp b/include/exiv2/types.hpp index 12a6d8711b..a301f69932 100644 --- a/include/exiv2/types.hpp +++ b/include/exiv2/types.hpp @@ -15,17 +15,6 @@ #include #include -/*! - @brief Macro to make calls to member functions through a pointer more readable. - See the C++ FAQ LITE, item - [33.5] How can I avoid syntax errors - when calling a member function using a pointer-to-member-function?. - */ -#define EXV_CALL_MEMBER_FN(object, ptrToMember) ((object).*(ptrToMember)) - -// ***************************************************************************** - // ***************************************************************************** // namespace extensions namespace Exiv2 { diff --git a/src/convert.cpp b/src/convert.cpp index 8c54e86c7b..cc51b70269 100644 --- a/src/convert.cpp +++ b/src/convert.cpp @@ -19,6 +19,7 @@ // + standard includes #include +#include #include #if defined _WIN32 @@ -499,7 +500,7 @@ Converter::Converter(IptcData& iptcData, XmpData& xmpData, const char* iptcChars void Converter::cnvToXmp() { for (auto&& c : conversion_) { if ((c.metadataId_ == mdExif && exifData_) || (c.metadataId_ == mdIptc && iptcData_)) { - EXV_CALL_MEMBER_FN(*this, c.key1ToKey2_)(c.key1_, c.key2_); + std::invoke(c.key1ToKey2_, *this, c.key1_, c.key2_); } } } @@ -507,7 +508,7 @@ void Converter::cnvToXmp() { void Converter::cnvFromXmp() { for (auto&& c : conversion_) { if ((c.metadataId_ == mdExif && exifData_) || (c.metadataId_ == mdIptc && iptcData_)) { - EXV_CALL_MEMBER_FN(*this, c.key2ToKey1_)(c.key2_, c.key1_); + std::invoke(c.key2ToKey1_, *this, c.key2_, c.key1_); } } } diff --git a/src/tiffvisitor_int.cpp b/src/tiffvisitor_int.cpp index 7c1de8b6d7..646949d3de 100644 --- a/src/tiffvisitor_int.cpp +++ b/src/tiffvisitor_int.cpp @@ -16,6 +16,7 @@ #include "tiffvisitor_int.hpp" // see bug #487 #include "value.hpp" +#include #include // ***************************************************************************** @@ -420,7 +421,7 @@ void TiffDecoder::decodeTiffEntry(const TiffEntryBase* object) { const DecoderFct decoderFct = findDecoderFct_(make_, object->tag(), object->group()); // skip decoding if decoderFct == 0 if (decoderFct) { - EXV_CALL_MEMBER_FN(*this, decoderFct)(object); + std::invoke(decoderFct, *this, object); } } // TiffDecoder::decodeTiffEntry @@ -736,7 +737,7 @@ void TiffEncoder::encodeTiffComponent(TiffEntryBase* object, const Exifdatum* da const EncoderFct fct = findEncoderFct_(make_, object->tag(), object->group()); if (fct) { // If an encoding function is registered for the tag, use it - EXV_CALL_MEMBER_FN(*this, fct)(object, ed); + std::invoke(fct, *this, object, ed); } else { // Else use the encode function at the object (results in a double-dispatch // to the appropriate encoding function of the encoder.