LibCarna Version 3.4.0
Loading...
Searching...
No Matches
Span.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 - 2016 Leonid Kostrykin
3 *
4 * Chair of Medical Engineering (mediTEC)
5 * RWTH Aachen University
6 * Pauwelsstr. 20
7 * 52074 Aachen
8 * Germany
9 *
10 *
11 * Copyright (C) 2021 - 2025 Leonid Kostrykin
12 *
13 */
14
15#ifndef SPAN_H_6014714286
16#define SPAN_H_6014714286
17
24
25namespace LibCarna
26{
27
28namespace base
29{
30
31namespace math
32{
33
34
35
36// ----------------------------------------------------------------------------------
37// Span
38// ----------------------------------------------------------------------------------
39
45template< typename T >
46class Span
47{
48
49public:
50
54 Span();
55
58 Span( const T& first, const T& last );
59
63 Span( const Span< T >& other );
64
68 bool operator==( const Span< T >& other ) const;
69
76 bool operator<( const Span< T >& other ) const;
77
82
87
88}; // Span
89
90
91template< typename T >
93 : first( T() ), last( T() )
94{
95}
96
97
98template< typename T >
99Span< T >::Span( const T& first, const T& last )
100 : first( first ), last( last )
101{
102}
103
104
105template< typename T >
107 : first( other.first )
108 , last( other.last )
109{
110}
111
112
113template< typename T >
115{
116 return isEqual( first, other.first ) && isEqual( last, other.last );
117}
118
119
120template< typename T >
122{
123 return first != other.first ? first < other.first : last < other.last;
124}
125
126
127
128} // namespace LibCarna :: base :: math
129
130} // namespace LibCarna :: base
131
132} // namespace LibCarna
133
134#endif // SPAN_H_6014714286
Represents an association.
Defines an interval with T.
Definition Span.hpp:47
Span()
Instantiates.
Definition Span.hpp:92
T first
Holds the of .
Definition Span.hpp:81
bool operator==(const Span< T > &other) const
Returns whether this span equals other.
Definition Span.hpp:114
T last
Holds the of .
Definition Span.hpp:86
bool operator<(const Span< T > &other) const
Compares this span to other.
Definition Span.hpp:121
Defines LibCarna::base::math namespace and LIBCARNA_FOR_VECTOR3UI.
bool isEqual(const InputType &x, const InputType &y)
Tells whether two objects are equal respectively to epsilon.
Definition math.hpp:178