From 9a64c2097b262c790f957447fb1bcbb494a5a776 Mon Sep 17 00:00:00 2001 From: hschreiber Date: Thu, 18 Apr 2024 18:09:54 +0200 Subject: [PATCH] change pointer to std::function to store also lambda function in chain_vine_swap --- .../Persistence_matrix/chain_vine_swap.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Persistence_matrix/include/gudhi/Persistence_matrix/chain_vine_swap.h b/src/Persistence_matrix/include/gudhi/Persistence_matrix/chain_vine_swap.h index 9a45723497..0e5a77b8fb 100644 --- a/src/Persistence_matrix/include/gudhi/Persistence_matrix/chain_vine_swap.h +++ b/src/Persistence_matrix/include/gudhi/Persistence_matrix/chain_vine_swap.h @@ -20,6 +20,7 @@ #include //std::swap & std::move #include +#include //std::function #include "chain_pairing.h" @@ -256,9 +257,8 @@ class Chain_vine_swap : public std::conditional - Chain_vine_swap(EventComparatorFunction&& birthComparator, - EventComparatorFunction&& deathComparator = _no_G_death_comparator); + Chain_vine_swap(std::function birthComparator, + std::function deathComparator = _no_G_death_comparator); /** * @brief Copy constructor. * @@ -326,8 +326,8 @@ class Chain_vine_swap : public std::conditional birthComp_; /**< for F x F & H x H. */ + std::function deathComp_; /**< for G x G. */ bool _is_negative_in_pair(index columnIndex); @@ -341,17 +341,16 @@ class Chain_vine_swap : public std::conditional -inline Chain_vine_swap::Chain_vine_swap() : CP(), birthComp_(nullptr), deathComp_(nullptr) +inline Chain_vine_swap::Chain_vine_swap() : CP(), birthComp_(), deathComp_() { static_assert(Master_matrix::Option_list::has_column_pairings, "If barcode is not stored, at least a birth comparator has to be specified."); } template -template -inline Chain_vine_swap::Chain_vine_swap(EventComparatorFunction&& birthComparator, - EventComparatorFunction&& deathComparator) - : CP(), birthComp_(&birthComparator), deathComp_(&deathComparator) +inline Chain_vine_swap::Chain_vine_swap(std::function birthComparator, + std::function deathComparator) + : CP(), birthComp_(std::move(birthComparator)), deathComp_(std::move(deathComparator)) {} template