kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Log | Files | Refs | README

commit 2c7c6681b13f292b7e72329cc8e07f2d22c6f064
parent 93b6371f1423f3243fab18a6fffff93fb915b623
Author: [email protected] <[email protected]>
Date:   Thu, 20 Dec 2018 17:51:45 +0000

Merge branch 'dev' of https://github.com/kfrlib/kfr into dev

Diffstat:
Minclude/kfr/base/univector.hpp | 31++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/include/kfr/base/univector.hpp b/include/kfr/base/univector.hpp @@ -46,6 +46,27 @@ enum : size_t tag_dynamic_vector = max_size_t, }; +template <typename T, univector_tag Tag = tag_dynamic_vector> +struct abstract_vector; + +template <typename T, univector_tag Size> +struct abstract_vector : std::array<T, Size> +{ + using std::array<T, Size>::array; +}; + +template <typename T> +struct abstract_vector<T, tag_dynamic_vector> : std::vector<T, allocator<T>> +{ + using std::vector<T, allocator<T>>::vector; +}; + +template <typename T> +struct abstract_vector<T, tag_array_ref> : array_ref<T> +{ + using array_ref<T>::array_ref; +}; + /** * @brief Class that represent data in KFR. Many KFR functions can take this class as an argument. * Can inherit from std::vector, std::array or keep only reference to data and its size. @@ -382,12 +403,12 @@ using univector_ref = univector<T, tag_array_ref>; template <typename T> using univector_dyn = univector<T, tag_dynamic_vector>; -template <typename T, size_t Size1 = tag_dynamic_vector, size_t Size2 = tag_dynamic_vector> -using univector2d = univector<univector<T, Size2>, Size1>; +template <typename T, univector_tag Size1 = tag_dynamic_vector, univector_tag Size2 = tag_dynamic_vector> +using univector2d = abstract_vector<univector<T, Size2>, Size1>; -template <typename T, size_t Size1 = tag_dynamic_vector, size_t Size2 = tag_dynamic_vector, - size_t Size3 = tag_dynamic_vector> -using univector3d = univector<univector<univector<T, Size3>, Size2>, Size1>; +template <typename T, univector_tag Size1 = tag_dynamic_vector, univector_tag Size2 = tag_dynamic_vector, + univector_tag Size3 = tag_dynamic_vector> +using univector3d = abstract_vector<abstract_vector<univector<T, Size3>, Size2>, Size1>; /// @brief Creates univector from data and size template <typename T>