File inkscape-c-standard.patch of Package inkscape.24910

From e6bb9d231f0f1324baa73e5a73f35509f7bad332 Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Tue, 14 Apr 2020 12:46:22 +0200
Subject: [PATCH] Bump C++ version to C++17.

The only change required was to remove now-unneeded pointer comparison
function for std::set.

See https://wiki.inkscape.org/wiki/index.php?title=C%2B%2B17 for the new
features available.
---
 CMakeLists.txt                        | 4 ++--
 src/object/color-profile.h            | 5 -----
 src/ui/dialog/document-properties.cpp | 2 +-
 src/ui/widget/color-icc-selector.cpp  | 2 +-
 src/vanishing-point.cpp               | 6 +++---
 src/vanishing-point.h                 | 8 +-------
 6 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 998989ad56..f7b07fdaa3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,9 +18,9 @@ message("Binary Dir: ${CMAKE_CURRENT_BINARY_DIR}")
 # -----------------------------------------------------------------------------
 # CMake Configuration
 # -----------------------------------------------------------------------------
-set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD 17)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
-# set(CMAKE_CXX_EXTENSIONS OFF) # enforces -std=c++11 instead of -std=gnu++11
+# set(CMAKE_CXX_EXTENSIONS OFF) # enforces -std=c++17 instead of -std=gnu++17
                                 # TODO: build currently fails with it as we actually depend on GNU compiler extensions...
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeScripts/Modules")
diff --git a/src/object/color-profile.h b/src/object/color-profile.h
index 5120b92fcd..d0b1df4eb5 100644
--- a/src/object/color-profile.h
+++ b/src/object/color-profile.h
@@ -48,11 +48,6 @@ public:
 
     bool operator<(ColorProfile const &other) const;
 
-    // we use std::set with pointers to ColorProfile, just having operator< isn't enough to sort these
-    struct pointerComparator {
-        bool operator()(const ColorProfile * const & a, const ColorProfile * const & b) { return (*a) < (*b); };
-    };
-
     friend cmsHPROFILE colorprofile_get_handle( SPDocument*, unsigned int*, char const* );
     friend class CMSSystem;
 
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 051c84aab2..3db226e60c 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -548,7 +548,7 @@ void DocumentProperties::populate_linked_profiles_box()
         _emb_profiles_observer.set((*(current.begin()))->parent);
     }
 
-    std::set<Inkscape::ColorProfile *, Inkscape::ColorProfile::pointerComparator> _current;
+    std::set<Inkscape::ColorProfile *> _current;
     std::transform(current.begin(),
                    current.end(),
                    std::inserter(_current, _current.begin()),
diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp
index 31006052b7..3feae8e708 100644
--- a/src/ui/widget/color-icc-selector.cpp
+++ b/src/ui/widget/color-icc-selector.cpp
@@ -680,7 +680,7 @@ void ColorICCSelectorImpl::_profilesChanged(std::string const &name)
     int index = 1;
     std::vector<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList("iccprofile");
 
-    std::set<Inkscape::ColorProfile *, Inkscape::ColorProfile::pointerComparator> _current;
+    std::set<Inkscape::ColorProfile *> _current;
     std::transform(current.begin(),
                    current.end(),
                    std::inserter(_current, _current.begin()),
diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp
index d5436cb173..d4b21f2511 100644
--- a/src/vanishing-point.cpp
+++ b/src/vanishing-point.cpp
@@ -102,7 +102,7 @@ static void vp_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, gui
         /* with Shift; if there is more than one box linked to this VP
            we need to split it and create a new perspective */
         if (dragger->numberOfBoxes() > 1) { // FIXME: Don't do anything if *all* boxes of a VP are selected
-            std::set<VanishingPoint *, less_ptr> sel_vps = dragger->VPsOfSelectedBoxes();
+            std::set<VanishingPoint *> sel_vps = dragger->VPsOfSelectedBoxes();
 
             std::list<SPBox3D *> sel_boxes;
             for (auto sel_vp : sel_vps) {
@@ -393,9 +393,9 @@ VanishingPoint *VPDragger::findVPWithBox(SPBox3D *box)
     return nullptr;
 }
 
-std::set<VanishingPoint *, less_ptr> VPDragger::VPsOfSelectedBoxes()
+std::set<VanishingPoint *> VPDragger::VPsOfSelectedBoxes()
 {
-    std::set<VanishingPoint *, less_ptr> sel_vps;
+    std::set<VanishingPoint *> sel_vps;
     VanishingPoint *vp;
     // FIXME: Should we take the selection from the parent VPDrag? I guess it shouldn't make a difference.
     Inkscape::Selection *sel = SP_ACTIVE_DESKTOP->getSelection();
diff --git a/src/vanishing-point.h b/src/vanishing-point.h
index d698241922..b8ccf18dd8 100644
--- a/src/vanishing-point.h
+++ b/src/vanishing-point.h
@@ -113,12 +113,6 @@ private:
 
 struct VPDrag;
 
-struct less_ptr : public std::binary_function<VanishingPoint *, VanishingPoint *, bool> {
-    bool operator()(VanishingPoint *vp1, VanishingPoint *vp2) {
-        return GPOINTER_TO_INT(vp1) < GPOINTER_TO_INT(vp2);
-    }
-};
-
 struct VPDragger {
 public:
     VPDragger(VPDrag *parent, Geom::Point p, VanishingPoint &vp);
@@ -143,7 +137,7 @@ public:
 
     unsigned int numberOfBoxes(); // the number of boxes linked to all VPs of the dragger
     VanishingPoint *findVPWithBox(SPBox3D *box);
-    std::set<VanishingPoint*, less_ptr> VPsOfSelectedBoxes();
+    std::set<VanishingPoint*> VPsOfSelectedBoxes();
 
     bool hasPerspective(const Persp3D *persp);
     void mergePerspectives(); // remove duplicate perspectives
-- 
2.35.1

openSUSE Build Service is sponsored by