summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2020-01-16 14:10:55 +0100
committerMarc Glisse <marc.glisse@inria.fr>2020-01-16 14:24:03 +0100
commit603f369bf32610bb8bfa9187a0d29a2ea6359b9e (patch)
tree082305f0c077c49378c1aeafdf0aeee4c4addd4e
parent14bbf619311968a39a98fdc3f6667384f5efc230 (diff)
Simplify DiagramTraits for pairs.
-rw-r--r--geom_matching/wasserstein/include/wasserstein.h30
1 files changed, 4 insertions, 26 deletions
diff --git a/geom_matching/wasserstein/include/wasserstein.h b/geom_matching/wasserstein/include/wasserstein.h
index 5be7691..2705043 100644
--- a/geom_matching/wasserstein/include/wasserstein.h
+++ b/geom_matching/wasserstein/include/wasserstein.h
@@ -56,33 +56,11 @@ struct DiagramTraits
static RealType get_y(const PointType& p) { return p[1]; }
};
-template<class PairContainer_>
-struct DiagramTraits<PairContainer_, std::pair<long double, long double>>
+template<class PairContainer_, class RealType_>
+struct DiagramTraits<PairContainer_, std::pair<RealType_, RealType_>>
{
- using PointType = std::pair<long double, long double>;
- using RealType = long double;
- using Container = std::vector<PointType>;
-
- static RealType get_x(const PointType& p) { return p.first; }
- static RealType get_y(const PointType& p) { return p.second; }
-};
-
-template<class PairContainer_>
-struct DiagramTraits<PairContainer_, std::pair<double, double>>
-{
- using PointType = std::pair<double, double>;
- using RealType = double;
- using Container = std::vector<PointType>;
-
- static RealType get_x(const PointType& p) { return p.first; }
- static RealType get_y(const PointType& p) { return p.second; }
-};
-
-template<class PairContainer_>
-struct DiagramTraits<PairContainer_, std::pair<float, float>>
-{
- using PointType = std::pair<float, float>;
- using RealType = float;
+ using RealType = RealType_;
+ using PointType = std::pair<RealType, RealType>;
using Container = std::vector<PointType>;
static RealType get_x(const PointType& p) { return p.first; }