herald  2.0.0
distance.h
1 // Copyright 2021 Herald Project Contributors
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #ifndef HERALD_DISTANCE_H
6 #define HERALD_DISTANCE_H
7 
8 #include <cstddef>
9 
10 namespace herald {
11 namespace datatype {
12 
15 struct Distance {
16  double value;
17 
18  Distance(); // default ctor (evaluates to 0)
19  Distance(double value);
20  Distance(const Distance& other); // copy ctor
21  Distance(Distance&& other); // move ctor
22  ~Distance();
23 
24  Distance& operator=(const Distance& other); // copy assign
25  Distance& operator=(Distance&& other); // move assign
26 
27  bool operator==(const double other) const noexcept;
28  bool operator!=(const double other) const noexcept;
29  bool operator==(const Distance& other) const noexcept;
30  bool operator!=(const Distance& other) const noexcept;
31  bool operator<(const Distance& other) const noexcept;
32  bool operator<=(const Distance& other) const noexcept;
33  bool operator>(const Distance& other) const noexcept;
34  bool operator>=(const Distance& other) const noexcept;
35 
36  operator double() const noexcept;
37 
38  std::size_t hashCode() const noexcept;
39 };
40 
41 }
42 }
43 
44 #endif
Acts as a non-global memory arena for arbitrary classes.
Definition: aggregates.h:15
Definition: distance.h:15