From c5788f362160832ec9bd51a895023d730cdb0e63 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Mon, 1 Mar 2021 00:09:13 +0100 Subject: [PATCH] Fix: clone() is good :) --- src/db/db/dbAsIfFlatRegion.cc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/db/db/dbAsIfFlatRegion.cc b/src/db/db/dbAsIfFlatRegion.cc index b5655efe7..f2fa65d1b 100644 --- a/src/db/db/dbAsIfFlatRegion.cc +++ b/src/db/db/dbAsIfFlatRegion.cc @@ -430,17 +430,17 @@ AsIfFlatRegion::selected_interacting_generic (const Edges &other, InteractingOut // shortcut if (empty ()) { if (output_mode == Positive || output_mode == Negative) { - return std::make_pair (const_cast (this), (RegionDelegate *) 0); + return std::make_pair (clone (), (RegionDelegate *) 0); } else { - return std::make_pair (const_cast (this), const_cast (this)); + return std::make_pair (clone (), clone ()); } } else if (max_count < min_count || other.empty ()) { if (output_mode == Positive) { return std::make_pair (new EmptyRegion (), (RegionDelegate *) 0); } else if (output_mode == Negative) { - return std::make_pair (const_cast (this), (RegionDelegate *) 0); + return std::make_pair (clone (), (RegionDelegate *) 0); } else { - return std::make_pair (new EmptyRegion (), const_cast (this)); + return std::make_pair (new EmptyRegion (), clone ()); } } @@ -481,17 +481,17 @@ AsIfFlatRegion::selected_interacting_generic (const Texts &other, InteractingOut // shortcut if (empty ()) { if (output_mode == Positive || output_mode == Negative) { - return std::make_pair (const_cast (this), (RegionDelegate *) 0); + return std::make_pair (clone (), (RegionDelegate *) 0); } else { - return std::make_pair (const_cast (this), const_cast (this)); + return std::make_pair (clone (), clone ()); } } else if (max_count < min_count || other.empty ()) { if (output_mode == Positive) { return std::make_pair (new EmptyRegion (), (RegionDelegate *) 0); } else if (output_mode == Negative) { - return std::make_pair (const_cast (this), (RegionDelegate *) 0); + return std::make_pair (clone (), (RegionDelegate *) 0); } else { - return std::make_pair (new EmptyRegion (), const_cast (this)); + return std::make_pair (new EmptyRegion (), clone ()); } } @@ -527,9 +527,9 @@ AsIfFlatRegion::selected_interacting_generic (const Region &other, int mode, boo // shortcut if (empty ()) { if (output_mode == Positive || output_mode == Negative) { - return std::make_pair (const_cast (this), (RegionDelegate *) 0); + return std::make_pair (clone (), (RegionDelegate *) 0); } else { - return std::make_pair (const_cast (this), const_cast (this)); + return std::make_pair (clone (), clone ()); } } else if (max_count < min_count || other.empty ()) { // clear, if b is empty and @@ -539,17 +539,17 @@ AsIfFlatRegion::selected_interacting_generic (const Region &other, int mode, boo if (output_mode == Positive) { return std::make_pair (new EmptyRegion (), (RegionDelegate *) 0); } else if (output_mode == Negative) { - return std::make_pair (const_cast (this), (RegionDelegate *) 0); + return std::make_pair (clone (), (RegionDelegate *) 0); } else { - return std::make_pair (new EmptyRegion (), const_cast (this)); + return std::make_pair (new EmptyRegion (), clone ()); } } else { if (output_mode == Positive) { - return std::make_pair (const_cast (this), (RegionDelegate *) 0); + return std::make_pair (clone(), (RegionDelegate *) 0); } else if (output_mode == Negative) { return std::make_pair (new EmptyRegion (), (RegionDelegate *) 0); } else { - return std::make_pair (const_cast (this), new EmptyRegion ()); + return std::make_pair (clone (), new EmptyRegion ()); } } }