static_assert

This commit is contained in:
2020-08-19 16:48:08 +03:00
parent ccd6a9888f
commit 05607ccf0e
6 changed files with 13 additions and 4 deletions

View File

@@ -131,6 +131,7 @@ inline PIVector<double> abs(const PIVector<double> & v) {
template <typename T>
bool OLS_Linear(const PIVector<PIPair<T, T> > & input, T * out_a, T * out_b) {
static_assert(std::is_arithmetic<T>::value, "Type must be arithmetic");
if (input.size_s() < 2)
return false;
int n = input.size_s();
@@ -154,6 +155,7 @@ bool OLS_Linear(const PIVector<PIPair<T, T> > & input, T * out_a, T * out_b) {
template <typename T>
bool WLS_Linear(const PIVector<PIPair<T, T> > & input, const PIVector<T> & weights, T * out_a, T * out_b) {
static_assert(std::is_arithmetic<T>::value, "Type must be arithmetic");
if (input.size_s() < 2)
return false;
if (input.size_s() != weights.size_s())