99#include < dsplib/slice.h>
1010#include < dsplib/indexing.h>
1111#include < dsplib/assert.h>
12+ #include < dsplib/span.h>
1213
1314namespace dsplib {
1415
@@ -25,8 +26,8 @@ using ResultType = conditional_t<std::is_same_v<T1, cmplx_t> || std::is_same_v<T
2526
2627template <typename T_dst, typename T_src>
2728base_array<T_dst> array_cast (const base_array<T_src>& src) noexcept {
28- static_assert (is_scalar_v<T_src> && is_scalar_v<T_dst>, " types must be scalar" );
29- static_assert (!(is_complex_v<T_src> && !is_complex_v<T_dst>), " complex to real cast is not allowed" );
29+ static_assert (is_scalar_v<T_src> && is_scalar_v<T_dst>, " Types must be scalar" );
30+ static_assert (!(is_complex_v<T_src> && !is_complex_v<T_dst>), " Complex to real cast is not allowed" );
3031 if constexpr (std::is_same_v<T_src, T_dst>) {
3132 return src;
3233 } else if constexpr (!is_complex_v<T_src> && is_complex_v<T_dst>) {
@@ -71,24 +72,6 @@ constexpr bool is_array_convertible() noexcept {
7172 return true ;
7273}
7374
74- template <typename T_dst, typename T_src>
75- base_array<T_dst> array_cast (const base_array<T_src>& src) noexcept {
76- static_assert (is_scalar_v<T_src> && is_scalar_v<T_dst>, " Types must be scalar" );
77- static_assert (!(is_complex_v<T_src> && !is_complex_v<T_dst>), " Complex to Real cast is not allowed" );
78-
79- if constexpr (std::is_same_v<T_src, T_dst>) {
80- return src;
81- } else if constexpr (!is_complex_v<T_src> && is_complex_v<T_dst>) {
82- base_array<T_dst> dst (src.size ());
83- for (int i = 0 ; i < src.size (); ++i) {
84- dst[i].re = static_cast <real_t >(src[i]);
85- }
86- return dst;
87- } else {
88- return base_array<T_dst>(src);
89- }
90- }
91-
9275// rules for implicit array conversion
9376// TODO: use static_assert and verbose error message
9477template <typename T_src, typename T_dst>
@@ -322,16 +305,6 @@ class base_array
322305 return r;
323306 }
324307
325- // --------------------------------------------------------------------
326- // TODO: remove
327- const T& operator ()(int i) const noexcept {
328- return this ->operator [](i);
329- }
330-
331- T& operator ()(int i) noexcept {
332- return this ->operator [](i);
333- }
334-
335308 // --------------------------------------------------------------------
336309 slice_t <T> slice (int i1, int i2, int m) {
337310 return slice_t <T>(_vec.data (), _vec.size (), i1, i2, m);
0 commit comments