blob: c8d48627b570fdc3400f6594913167ea42f8e99a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#ifndef HERA_DIAGRAM_TRAITS_H
#define HERA_DIAGRAM_TRAITS_H
namespace hera {
template<class PairContainer_, class PointType_ = typename std::remove_reference< decltype(*std::declval<PairContainer_>().begin())>::type >
struct DiagramTraits
{
using Container = PairContainer_;
using PointType = PointType_;
using RealType = typename std::remove_reference< decltype(std::declval<PointType>()[0]) >::type;
static RealType get_x(const PointType& p) { return p[0]; }
static RealType get_y(const PointType& p) { return p[1]; }
};
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 Container = std::vector<PointType>;
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
|