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 
43 #include <blaze/util/Types.h>
44 #include <blaze/util/Unused.h>
45 
46 
47 namespace blaze {
48 
49 //=================================================================================================
50 //
51 // CLASS DEFINITION
52 //
53 //=================================================================================================
54 
55 //*************************************************************************************************
63 template< 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 //*************************************************************************************************
86 template<>
87 struct SubvectorData<>
88 {
89  public:
90  //**Constructors********************************************************************************
93  template< typename... RSAs >
94  explicit inline SubvectorData( size_t index, size_t n, RSAs... args );
95  // No explicitly declared copy constructor.
97  //**********************************************************************************************
98 
99  //**Destructor**********************************************************************************
100  // No explicitly declared destructor.
101  //**********************************************************************************************
102 
103  //**Assignment operators************************************************************************
104  SubvectorData& operator=( const SubvectorData& ) = delete;
105  //**********************************************************************************************
106 
107  //**Utility functions***************************************************************************
110  inline size_t offset() const noexcept;
111  inline size_t size () const noexcept;
113  //**********************************************************************************************
114 
115  private:
116  //**Member variables****************************************************************************
119  const size_t offset_;
120  const size_t size_;
121 
122  //**********************************************************************************************
123 };
125 //*************************************************************************************************
126 
127 
128 //*************************************************************************************************
136 template< typename... RSAs > // Optional subvector arguments
137 inline SubvectorData<>::SubvectorData( size_t index, size_t n, RSAs... args )
138  : offset_( index ) // The offset of the subvector within the vector
139  , size_ ( n ) // The size of the subvector
140 {
141  UNUSED_PARAMETER( args... );
142 }
144 //*************************************************************************************************
145 
146 
147 //*************************************************************************************************
153 inline size_t SubvectorData<>::offset() const noexcept
154 {
155  return offset_;
156 }
158 //*************************************************************************************************
159 
160 
161 //*************************************************************************************************
167 inline size_t SubvectorData<>::size() const noexcept
168 {
169  return size_;
170 }
172 //*************************************************************************************************
173 
174 
175 
176 
177 //=================================================================================================
178 //
179 // CLASS TEMPLATE SPECIALIZATION FOR TWO COMPILE TIME ARGUMENTS
180 //
181 //=================================================================================================
182 
183 //*************************************************************************************************
192 template< size_t I // Index of the first element
193  , size_t N > // Number of elements
194 struct SubvectorData<I,N>
195 {
196  public:
197  //**Constructors********************************************************************************
200  template< typename... RSAs >
201  explicit inline SubvectorData( RSAs... args );
202  // No explicitly declared copy constructor.
204  //**********************************************************************************************
205 
206  //**Destructor**********************************************************************************
207  // No explicitly declared destructor.
208  //**********************************************************************************************
209 
210  //**Assignment operators************************************************************************
211  SubvectorData& operator=( const SubvectorData& ) = delete;
212  //**********************************************************************************************
213 
214  //**Utility functions***************************************************************************
217  static inline constexpr size_t offset() noexcept;
218  static inline constexpr size_t size () noexcept;
220  //**********************************************************************************************
221 };
223 //*************************************************************************************************
224 
225 
226 //*************************************************************************************************
232 template< size_t I // Index of the first element
233  , size_t N > // Number of elements
234 template< typename... RSAs > // Optional subvector arguments
235 inline SubvectorData<I,N>::SubvectorData( RSAs... args )
236 {
237  UNUSED_PARAMETER( args... );
238 }
240 //*************************************************************************************************
241 
242 
243 //*************************************************************************************************
249 template< size_t I // Index of the first element
250  , size_t N > // Number of elements
251 inline constexpr size_t SubvectorData<I,N>::offset() noexcept
252 {
253  return I;
254 }
256 //*************************************************************************************************
257 
258 
259 //*************************************************************************************************
265 template< size_t I // Index of the first element
266  , size_t N > // Number of elements
267 inline constexpr size_t SubvectorData<I,N>::size() noexcept
268 {
269  return N;
270 }
272 //*************************************************************************************************
273 
274 } // namespace blaze
275 
276 #endif
Header file for the UNUSED_PARAMETER function template.
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
Auxiliary class template for the data members of the Subvector class.The auxiliary SubvectorData clas...
Definition: SubvectorData.h:64
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81