Carna Version 3.3.3
Loading...
Searching...
No Matches
Span.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 - 2015 Leonid Kostrykin
3 *
4 * Chair of Medical Engineering (mediTEC)
5 * RWTH Aachen University
6 * Pauwelsstr. 20
7 * 52074 Aachen
8 * Germany
9 *
10 */
11
12#ifndef SPAN_H_6014714286
13#define SPAN_H_6014714286
14
19#include <Carna/base/math.h>
20
21namespace Carna
22{
23
24namespace base
25{
26
27namespace math
28{
29
30
31
32// ----------------------------------------------------------------------------------
33// Span
34// ----------------------------------------------------------------------------------
35
42template< typename T >
43class Span
44{
45
46public:
47
52
55 Span( const T& first, const T& last );
56
60 Span( const Span< T >& other );
61
65 bool operator==( const Span< T >& other ) const;
66
73 bool operator<( const Span< T >& other ) const;
74
79
84
85}; // Span
86
87
88template< typename T >
90 : first( T() ), last( T() )
91{
92}
93
94
95template< typename T >
96Span< T >::Span( const T& first, const T& last )
97 : first( first ), last( last )
98{
99}
100
101
102template< typename T >
104 : first( other.first )
105 , last( other.last )
106{
107}
108
109
110template< typename T >
112{
113 return isEqual( first, other.first ) && isEqual( last, other.last );
114}
115
116
117template< typename T >
119{
120 return first != other.first ? first < other.first : last < other.last;
121}
122
123
124
125} // namespace Carna :: base :: math
126
127} // namespace Carna :: base
128
129} // namespace Carna
130
131#endif // SPAN_H_6014714286
Represents an association.
Definition Association.h:45
Defines an interval with T.
Definition Span.h:44
T last
Holds the of .
Definition Span.h:83
bool operator<(const Span< T > &other) const
Compares this span to other.
Definition Span.h:118
T first
Holds the of .
Definition Span.h:78
Span()
Instantiates.
Definition Span.h:89
bool operator==(const Span< T > &other) const
Returns whether this span equals other.
Definition Span.h:111
Span(const T &first, const T &last)
Definition Span.h:96
Span(const Span< T > &other)
Copies other.
Definition Span.h:103
Defines Carna::base::math namespace and CARNA_FOR_VECTOR3UI.
bool isEqual(const InputType &x, const InputType &y)
Tells whether two objects are equal respectively to epsilon.
Definition math.h:174