Blaze 3.9
SubvectorData.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_VIEWS_SUBVECTOR_SUBVECTORDATA_H_
36#define _BLAZE_MATH_VIEWS_SUBVECTOR_SUBVECTORDATA_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
44#include <blaze/util/Types.h>
45
46
47namespace blaze {
48
49//=================================================================================================
50//
51// CLASS DEFINITION
52//
53//=================================================================================================
54
55//*************************************************************************************************
63template< size_t... CSAs > // Compile time subvector arguments
65{};
66//*************************************************************************************************
67
68
69
70
71//=================================================================================================
72//
73// CLASS TEMPLATE SPECIALIZATION FOR ZERO COMPILE TIME ARGUMENTS
74//
75//=================================================================================================
76
77//*************************************************************************************************
86template<>
87class SubvectorData<>
88{
89 public:
90 //**Compile time flags**************************************************************************
92
96 static constexpr bool compileTimeArgs = false;
97 //**********************************************************************************************
98
99 //**Constructors********************************************************************************
102 template< typename... RSAs >
103 inline SubvectorData( size_t index, size_t n, RSAs... args );
104
105 SubvectorData( const SubvectorData& ) = default;
107 //**********************************************************************************************
108
109 //**Destructor**********************************************************************************
112 ~SubvectorData() = default;
114 //**********************************************************************************************
115
116 //**Assignment operators************************************************************************
119 SubvectorData& operator=( const SubvectorData& ) = delete;
121 //**********************************************************************************************
122
123 //**Utility functions***************************************************************************
126 inline size_t offset() const noexcept;
127 inline size_t size () const noexcept;
129 //**********************************************************************************************
130
131 private:
132 //**Member variables****************************************************************************
135 const size_t offset_;
136 const size_t size_;
138 //**********************************************************************************************
139};
141//*************************************************************************************************
142
143
144//*************************************************************************************************
152template< typename... RSAs > // Optional subvector arguments
153inline SubvectorData<>::SubvectorData( size_t index, size_t n, RSAs... args )
154 : offset_( index ) // The offset of the subvector within the vector
155 , size_ ( n ) // The size of the subvector
156{
157 MAYBE_UNUSED( args... );
158}
160//*************************************************************************************************
161
162
163//*************************************************************************************************
169inline size_t SubvectorData<>::offset() const noexcept
170{
171 return offset_;
172}
174//*************************************************************************************************
175
176
177//*************************************************************************************************
183inline size_t SubvectorData<>::size() const noexcept
184{
185 return size_;
186}
188//*************************************************************************************************
189
190
191
192
193//=================================================================================================
194//
195// CLASS TEMPLATE SPECIALIZATION FOR TWO COMPILE TIME ARGUMENTS
196//
197//=================================================================================================
198
199//*************************************************************************************************
208template< size_t I // Index of the first element
209 , size_t N > // Number of elements
210class SubvectorData<I,N>
211{
212 public:
213 //**Compile time flags**************************************************************************
215
219 static constexpr bool compileTimeArgs = true;
220 //**********************************************************************************************
221
222 //**Constructors********************************************************************************
225 template< typename... RSAs >
226 explicit inline SubvectorData( RSAs... args );
227
228 SubvectorData( const SubvectorData& ) = default;
230 //**********************************************************************************************
231
232 //**Destructor**********************************************************************************
235 ~SubvectorData() = default;
237 //**********************************************************************************************
238
239 //**Assignment operators************************************************************************
242 SubvectorData& operator=( const SubvectorData& ) = delete;
244 //**********************************************************************************************
245
246 //**Utility functions***************************************************************************
249 static constexpr size_t offset() noexcept;
250 static constexpr size_t size () noexcept;
252 //**********************************************************************************************
253};
255//*************************************************************************************************
256
257
258//*************************************************************************************************
264template< size_t I // Index of the first element
265 , size_t N > // Number of elements
266template< typename... RSAs > // Optional subvector arguments
267inline SubvectorData<I,N>::SubvectorData( RSAs... args )
268{
269 MAYBE_UNUSED( args... );
270}
272//*************************************************************************************************
273
274
275//*************************************************************************************************
281template< size_t I // Index of the first element
282 , size_t N > // Number of elements
283constexpr size_t SubvectorData<I,N>::offset() noexcept
284{
285 return I;
286}
288//*************************************************************************************************
289
290
291//*************************************************************************************************
297template< size_t I // Index of the first element
298 , size_t N > // Number of elements
299constexpr size_t SubvectorData<I,N>::size() noexcept
300{
301 return N;
302}
304//*************************************************************************************************
305
306} // namespace blaze
307
308#endif
Header file for the MAYBE_UNUSED function template.
Auxiliary class template for the data members of the Subvector class.
Definition: SubvectorData.h:65
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for basic type definitions.