Generic class libraries for 1D array and 2D array: Array and Matrix. 1次元および2次元配列用の汎用クラスライブラリ: Array と Matrix.
Dependents: F746_SD_WavPlayer CW_Decoder_using_FFT_on_F446 F446_MySoundMachine F446_ADF_Nlms ... more
Diff: Array.hpp
- Revision:
- 4:d3aa1ddb57e1
- Parent:
- 3:d9dea7748b27
--- a/Array.hpp Tue Nov 19 05:44:54 2019 +0000 +++ b/Array.hpp Sat Dec 19 08:22:52 2020 +0000 @@ -3,7 +3,7 @@ // Macro definition "DEBUG_ARRAY_CHECK" enables to check // range of index. // -// 2019/11/19, Copyright (c) 2019 MIKAMI, Naoki +// 2020/12/19, Copyright (c) 2020 MIKAMI, Naoki //----------------------------------------------------------------------- #include "mbed.h" @@ -19,7 +19,7 @@ public: explicit Array(int n = 1) { ArrayNew(n); } // default constructor Array(const Array<T>& a) { Copy(a); } // copy constructor - Array(int n, T initialValue); // constructor with initialization + Array(int n, T initialVal); // constructor with initialization Array(int n, const T val[]); // constructor with assignment built-in array ~Array() { delete[] v_; } // destructor void Fill(T val); // fill with same value @@ -46,12 +46,12 @@ //----------------------------------------------------------------------- // constructor with initialization - template <class T> inline Array<T>::Array(int n, T initialValue) + template <class T> inline Array<T>::Array(int n, T initialVal) { ArrayNew(n); - Fill(initialValue); + Fill(initialVal); } - + // constructor with assignment built-in array template <class T> inline Array<T>::Array(int n, const T val[]) { @@ -68,14 +68,14 @@ // fill with same value template <class T> inline void Array<T>::Fill(T val) { - for (int n=0; n<size_; n++) v_[n] = val; + for (int n=0; n<size_; n++) v_[n] = val; } // assign built-in array template <class T> inline void Array<T>::Assign(const T val[]) { - for (int n=0; n<size_; n++) v_[n] = val[n]; - } + for (int n=0; n<size_; n++) v_[n] = val[n]; + } template <class T> inline Array<T>& Array<T>::operator=(const Array<T>& a) {