From 0cc35ad04f9c2997014d7cf62a12f697e79fb534 Mon Sep 17 00:00:00 2001 From: Arnur Nigmetov Date: Sat, 20 Jan 2018 19:11:29 +0100 Subject: Major rewrite, templatized version --- geom_bottleneck/include/diagram_traits.h | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 geom_bottleneck/include/diagram_traits.h (limited to 'geom_bottleneck/include/diagram_traits.h') diff --git a/geom_bottleneck/include/diagram_traits.h b/geom_bottleneck/include/diagram_traits.h new file mode 100644 index 0000000..c8d4862 --- /dev/null +++ b/geom_bottleneck/include/diagram_traits.h @@ -0,0 +1,45 @@ +#ifndef HERA_DIAGRAM_TRAITS_H +#define HERA_DIAGRAM_TRAITS_H + +namespace hera { + +template().begin())>::type > +struct DiagramTraits +{ + using Container = PairContainer_; + using PointType = PointType_; + using RealType = typename std::remove_reference< decltype(std::declval()[0]) >::type; + + static RealType get_x(const PointType& p) { return p[0]; } + static RealType get_y(const PointType& p) { return p[1]; } +}; + + +template +struct DiagramTraits> +{ + using PointType = std::pair; + using RealType = double; + using Container = std::vector; + + static RealType get_x(const PointType& p) { return p.first; } + static RealType get_y(const PointType& p) { return p.second; } +}; + + +template +struct DiagramTraits> +{ + using PointType = std::pair; + using RealType = float; + using Container = std::vector; + + static RealType get_x(const PointType& p) { return p.first; } + static RealType get_y(const PointType& p) { return p.second; } +}; + + +} // end namespace hera + + +#endif // HERA_DIAGRAM_TRAITS_H -- cgit v1.2.3