|
|
|
|
@ -48,7 +48,11 @@ template<size_t size, class T> class Vector {
|
|
|
|
|
return *reinterpret_cast<Vector<size, T>*>(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** @copybrief from(T*) @copydetails from(T*) */ |
|
|
|
|
/**
|
|
|
|
|
* @copybrief from(T*) |
|
|
|
|
* @copydetails from(T*) |
|
|
|
|
* @todoc Remove workaround when Doxygen supports \@copydoc again |
|
|
|
|
*/ |
|
|
|
|
inline constexpr static const Vector<size, T>& from(const T* data) { |
|
|
|
|
return *reinterpret_cast<const Vector<size, T>*>(data); |
|
|
|
|
} |
|
|
|
|
@ -89,6 +93,8 @@ template<size_t size, class T> class Vector {
|
|
|
|
|
* @brief Initializer-list constructor |
|
|
|
|
* @param first First value |
|
|
|
|
* @param next Next values |
|
|
|
|
* |
|
|
|
|
* @todoc Remove workaround when Doxygen supports uniform initialization |
|
|
|
|
*/ |
|
|
|
|
#ifndef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
template<class ...U> inline constexpr Vector(T first, U... next): _data{first, next...} { |
|
|
|
|
@ -118,11 +124,23 @@ template<size_t size, class T> class Vector {
|
|
|
|
|
* @return Array with the same size as the vector |
|
|
|
|
*/ |
|
|
|
|
inline T* data() { return _data; } |
|
|
|
|
inline constexpr const T* data() const { return _data; } /**< @copybrief data() @copydetails data() */ |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @copybrief data() |
|
|
|
|
* @copydetails data() |
|
|
|
|
* @todoc Remove workaround when Doxygen supports \@copydoc again |
|
|
|
|
*/ |
|
|
|
|
inline constexpr const T* data() const { return _data; } |
|
|
|
|
|
|
|
|
|
/** @brief Value at given position */ |
|
|
|
|
inline T& operator[](size_t pos) { return _data[pos]; } |
|
|
|
|
inline constexpr T operator[](size_t pos) const { return _data[pos]; } /**< @copybrief operator[]() @copydetails operator[]() */ |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @copybrief operator[]() |
|
|
|
|
* @copydetails operator[]() |
|
|
|
|
* @todoc Remove workaround when Doxygen supports \@copydoc again |
|
|
|
|
*/ |
|
|
|
|
inline constexpr T operator[](size_t pos) const { return _data[pos]; } |
|
|
|
|
|
|
|
|
|
/** @brief Equality operator */ |
|
|
|
|
inline bool operator==(const Vector<size, T>& other) const { |
|
|
|
|
|