tmp
This commit is contained in:
parent
8b294f61d6
commit
2ce5da95b0
@ -62,8 +62,8 @@ namespace gctl
|
||||
typedef array<float> _1f_array; ///< 1-D single-precision floating-point array
|
||||
typedef array<double> _1d_array; ///< 1-D double-precision floating-point array
|
||||
typedef array<std::string> _1s_array; ///< 1-D string array
|
||||
typedef array<std::complex<float>> _1cf_array; ///< 1-D complex float array
|
||||
typedef array<std::complex<double>> _1cd_array; ///< 1-D complex double array
|
||||
typedef array<std::complex<float> > _1cf_array; ///< 1-D complex float array
|
||||
typedef array<std::complex<double> > _1cd_array; ///< 1-D complex double array
|
||||
|
||||
/**
|
||||
* @brief Iterator template. This could be used to enable the use of iteration algorithms for array-like objects.
|
||||
@ -145,7 +145,7 @@ namespace gctl
|
||||
*
|
||||
* @param init_val Initial values
|
||||
*/
|
||||
array(std::initializer_list<ArrValType> init_val);
|
||||
array(std::vector<ArrValType> init_val);
|
||||
|
||||
/**
|
||||
* @brief Construct a new array object as a sequence
|
||||
@ -394,7 +394,7 @@ namespace gctl
|
||||
*
|
||||
* @param init_val Initial values
|
||||
*/
|
||||
void resize(std::initializer_list<ArrValType> init_val);
|
||||
void resize(std::vector<ArrValType> init_val);
|
||||
|
||||
/**
|
||||
* @brief Resize a new array object as a sequence
|
||||
@ -894,7 +894,7 @@ namespace gctl
|
||||
}
|
||||
|
||||
template <typename ArrValType>
|
||||
array<ArrValType>::array(std::initializer_list<ArrValType> init_val)
|
||||
array<ArrValType>::array(std::vector<ArrValType> init_val)
|
||||
{
|
||||
length_ = 0;
|
||||
val_ = nullptr;
|
||||
@ -1244,15 +1244,12 @@ namespace gctl
|
||||
}
|
||||
|
||||
template <typename ArrValType>
|
||||
void array<ArrValType>::resize(std::initializer_list<ArrValType> init_val)
|
||||
void array<ArrValType>::resize(std::vector<ArrValType> init_val)
|
||||
{
|
||||
resize(init_val.size());
|
||||
|
||||
typename std::initializer_list<ArrValType>::iterator iter = init_val.begin();
|
||||
for (size_t i = 0; i < length_; i++)
|
||||
{
|
||||
val_[i] = *iter;
|
||||
iter++;
|
||||
val_[i] = init_val[i];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ namespace gctl
|
||||
public:
|
||||
runtime_error() : std::runtime_error("GCTL: Unexpected runtime error."){}
|
||||
runtime_error(std::string estr) : std::runtime_error(("GCTL: Unexpected runtime error. "+estr).c_str()){}
|
||||
virtual ~runtime_error(){}
|
||||
//virtual ~runtime_error(){}
|
||||
};
|
||||
|
||||
class range_error : public std::range_error
|
||||
@ -122,7 +122,7 @@ namespace gctl
|
||||
public:
|
||||
range_error() : std::range_error("GCTL: Invalid range detected."){}
|
||||
range_error(std::string estr) : std::range_error(("GCTL: Invalid range detected. "+estr).c_str()){}
|
||||
virtual ~range_error(){}
|
||||
//virtual ~range_error(){}
|
||||
};
|
||||
|
||||
class overflow_error : public std::overflow_error
|
||||
@ -130,7 +130,7 @@ namespace gctl
|
||||
public:
|
||||
overflow_error() : std::overflow_error("GCTL: Overflow error."){}
|
||||
overflow_error(std::string estr) : std::overflow_error(("GCTL: Overflow error. "+estr).c_str()){}
|
||||
virtual ~overflow_error(){}
|
||||
//virtual ~overflow_error(){}
|
||||
};
|
||||
|
||||
class underflow_error : public std::underflow_error
|
||||
@ -138,7 +138,7 @@ namespace gctl
|
||||
public:
|
||||
underflow_error() : std::underflow_error("GCTL: Underflow error."){}
|
||||
underflow_error(std::string estr) : std::underflow_error(("GCTL: Underflow error. "+estr).c_str()){}
|
||||
virtual ~underflow_error(){}
|
||||
//virtual ~underflow_error(){}
|
||||
};
|
||||
|
||||
|
||||
@ -147,7 +147,7 @@ namespace gctl
|
||||
public:
|
||||
logic_error() : std::logic_error("GCTL: Logic error."){}
|
||||
logic_error(std::string estr) : std::logic_error(("GCTL: Logic error. "+estr).c_str()){}
|
||||
virtual ~logic_error(){}
|
||||
//virtual ~logic_error(){}
|
||||
};
|
||||
|
||||
class domain_error : public std::domain_error
|
||||
@ -155,7 +155,7 @@ namespace gctl
|
||||
public:
|
||||
domain_error() : std::domain_error("GCTL: Domain error."){}
|
||||
domain_error(std::string estr) : std::domain_error(("GCTL: Domain error. "+estr).c_str()){}
|
||||
virtual ~domain_error(){}
|
||||
//virtual ~domain_error(){}
|
||||
};
|
||||
|
||||
class invalid_argument : public std::invalid_argument
|
||||
@ -163,7 +163,7 @@ namespace gctl
|
||||
public:
|
||||
invalid_argument() : std::invalid_argument("GCTL: Invalid argument."){}
|
||||
invalid_argument(std::string estr) : std::invalid_argument(("GCTL: Invalid argument. "+estr).c_str()){}
|
||||
virtual ~invalid_argument(){}
|
||||
//virtual ~invalid_argument(){}
|
||||
};
|
||||
|
||||
class length_error : public std::length_error
|
||||
@ -171,7 +171,7 @@ namespace gctl
|
||||
public:
|
||||
length_error() : std::length_error("GCTL: Length error."){}
|
||||
length_error(std::string estr) : std::length_error(("GCTL: Length error. "+estr).c_str()){}
|
||||
virtual ~length_error(){}
|
||||
//virtual ~length_error(){}
|
||||
};
|
||||
|
||||
class out_of_range : public std::out_of_range
|
||||
@ -179,7 +179,7 @@ namespace gctl
|
||||
public:
|
||||
out_of_range() : std::out_of_range("GCTL: Out of range."){}
|
||||
out_of_range(std::string estr) : std::out_of_range(("GCTL: Out of range. "+estr).c_str()){}
|
||||
virtual ~out_of_range(){}
|
||||
//virtual ~out_of_range(){}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -45,8 +45,8 @@ namespace gctl
|
||||
typedef matrix<float> _2f_matrix; ///< 2-D single-precision floating-point array
|
||||
typedef matrix<double> _2d_matrix; ///< 2-D double-precision floating-point array
|
||||
typedef matrix<std::string> _2s_matrix; ///< 2-D string array
|
||||
typedef matrix<std::complex<float>> _2cf_matrix; ///< 1-D complex float array
|
||||
typedef matrix<std::complex<double>> _2cd_matrix; ///< 1-D complex double array
|
||||
typedef matrix<std::complex<float> > _2cf_matrix; ///< 1-D complex float array
|
||||
typedef matrix<std::complex<double> > _2cd_matrix; ///< 1-D complex double array
|
||||
|
||||
/**
|
||||
* @brief 二维数组模版
|
||||
|
@ -42,8 +42,8 @@ namespace gctl
|
||||
typedef spmat<int> _1i_spmat; ///< 整形浮点稀疏矩阵
|
||||
typedef spmat<float> _1f_spmat; ///< 单精度浮点稀疏矩阵
|
||||
typedef spmat<double> _1d_spmat; ///< 双精度浮点稀疏矩阵
|
||||
typedef spmat<std::complex<float>> _1cf_spmat; ///< 单精度复浮点稀疏矩阵
|
||||
typedef spmat<std::complex<double>> _1cd_spmat; ///< 双精度复浮点稀疏矩阵
|
||||
typedef spmat<std::complex<float> > _1cf_spmat; ///< 单精度复浮点稀疏矩阵
|
||||
typedef spmat<std::complex<double> > _1cd_spmat; ///< 双精度复浮点稀疏矩阵
|
||||
|
||||
/**
|
||||
* @brief 稀疏矩阵的节点元素类型
|
||||
|
@ -41,14 +41,14 @@ namespace gctl
|
||||
typedef std::vector<float> _1f_vector; ///< 1-D single-precision floating-point vector
|
||||
typedef std::vector<double> _1d_vector; ///< 1-D double-precision floating-point vector
|
||||
typedef std::vector<std::string> _1s_vector; ///< 1-D string vector
|
||||
typedef std::vector<std::complex<float>> _1cf_vector; ///< 1-D complex float vector
|
||||
typedef std::vector<std::complex<double>> _1cd_vector; ///< 1-D complex double vector
|
||||
typedef std::vector<std::vector<int>> _2i_vector; ///< 2-D integer vector
|
||||
typedef std::vector<std::vector<float>> _2f_vector; ///< 2-D single-precision floating-point vector
|
||||
typedef std::vector<std::vector<double>> _2d_vector; ///< 2-D double-precision floating-point vector
|
||||
typedef std::vector<std::vector<std::string>> _2s_vector; ///< 2-D string vector
|
||||
typedef std::vector<std::vector<std::complex<float>>> _2cf_vector; ///< 2-D complex float vector
|
||||
typedef std::vector<std::vector<std::complex<double>>> _2cd_vector; ///< 2-D complex double vector
|
||||
typedef std::vector<std::complex<float> > _1cf_vector; ///< 1-D complex float vector
|
||||
typedef std::vector<std::complex<double> > _1cd_vector; ///< 1-D complex double vector
|
||||
typedef std::vector<std::vector<int> > _2i_vector; ///< 2-D integer vector
|
||||
typedef std::vector<std::vector<float> > _2f_vector; ///< 2-D single-precision floating-point vector
|
||||
typedef std::vector<std::vector<double> > _2d_vector; ///< 2-D double-precision floating-point vector
|
||||
typedef std::vector<std::vector<std::string> > _2s_vector; ///< 2-D string vector
|
||||
typedef std::vector<std::vector<std::complex<float> > > _2cf_vector; ///< 2-D complex float vector
|
||||
typedef std::vector<std::vector<std::complex<double> > > _2cd_vector; ///< 2-D complex double vector
|
||||
|
||||
/**
|
||||
* @brief Clear the memory space used by a 1-D vector
|
||||
|
@ -132,7 +132,7 @@ namespace gctl
|
||||
}
|
||||
|
||||
template <typename ValueType>
|
||||
void str2type_vector2d(const std::vector<std::vector<std::string>> &vec2d,
|
||||
void str2type_vector2d(const std::vector<std::vector<std::string> > &vec2d,
|
||||
std::string order_str, std::vector<ValueType> &vec)
|
||||
{
|
||||
int idx;
|
||||
@ -174,7 +174,7 @@ namespace gctl
|
||||
}
|
||||
|
||||
template <typename ValueType>
|
||||
void type2str_vector2d(std::vector<std::vector<ValueType>> &vec2d,
|
||||
void type2str_vector2d(std::vector<std::vector<ValueType> > &vec2d,
|
||||
const std::vector<std::string> &vec)
|
||||
{
|
||||
std::vector<std::string> str_vec;
|
||||
@ -185,7 +185,7 @@ namespace gctl
|
||||
}
|
||||
|
||||
template <typename ValueType, typename... Args>
|
||||
void type2str_vector2d(std::vector<std::vector<ValueType>> &vec2d,
|
||||
void type2str_vector2d(std::vector<std::vector<ValueType> > &vec2d,
|
||||
const std::vector<std::string> &vec, Args&... rest)
|
||||
{
|
||||
std::vector<std::string> str_vec;
|
||||
|
Loading…
Reference in New Issue
Block a user