Commit 673d95b1 authored by Ing. Jan Trávníček's avatar Ing. Jan Trávníček

comparison is always zero

parent 1f91ca7a
......@@ -44,9 +44,10 @@ private:
public:
NaryOperationAbstractionImpl ( ) {
for ( size_t i = 0; i < NumberOfParams; ++ i ) {
m_params [ i ] = nullptr;
}
if constexpr ( NumberOfParams != 0 )
for ( size_t i = 0; i < NumberOfParams; ++ i ) {
m_params [ i ] = nullptr;
}
}
bool inputsAttached ( ) const override {
......
......@@ -47,9 +47,10 @@ protected:
public:
WrapperAbstractionImpl ( ) {
for ( size_t i = 0; i < NumberOfParams; ++ i ) {
m_params [ i ] = nullptr;
}
if constexpr ( NumberOfParams != 0 )
for ( size_t i = 0; i < NumberOfParams; ++ i ) {
m_params [ i ] = nullptr;
}
}
private:
......
......@@ -15,6 +15,8 @@ public:
static std::array < std::string, ParameterTypesNumber > generateNames ( ParamNames ... paramNames ) {
if constexpr ( sizeof ... ( ParamNames ) > ParameterTypesNumber ) {
static_assert ( "Too many parameter names" );
} else if constexpr ( ParameterTypesNumber == 0 ) {
return std::array < std::string, ParameterTypesNumber > {};
} else {
std::array < std::string, ParameterTypesNumber > parameterNames = { { paramNames ... } };
for ( size_t i = sizeof ... ( ParamNames ); i < ParameterTypesNumber; ++ i )
......
......@@ -150,8 +150,9 @@ public:
* \param other the source array
*/
ptr_array ( const ptr_array & other ) {
for ( size_type i = 0; i < N; ++ i )
m_data.at ( i ) = ext::clone ( other.at ( i ) );
if constexpr ( N != 0 )
for ( size_type i = 0; i < N; ++ i )
m_data.at ( i ) = ext::clone ( other.at ( i ) );
}
/**
......@@ -161,8 +162,9 @@ public:
* \param other the source array
*/
ptr_array ( ptr_array && other ) noexcept {
for ( size_type i = 0; i < N; ++ i )
m_data.at ( i ) = std::exchange ( other.m_data.at ( i ), nullptr );
if constexpr ( N != 0 )
for ( size_type i = 0; i < N; ++ i )
m_data.at ( i ) = std::exchange ( other.m_data.at ( i ), nullptr );
}
/**
......@@ -170,8 +172,9 @@ public:
* Destructor of the pointer array.
*/
~ptr_array ( ) noexcept {
for ( size_type i = 0; i < N; ++ i )
delete m_data.at ( i );
if constexpr ( N != 0 )
for ( size_type i = 0; i < N; ++ i )
delete m_data.at ( i );
}
/**
......@@ -184,10 +187,11 @@ public:
if ( this == & other )
return * this;
for ( size_type i = 0; i < N; ++ i ) {
delete m_data.at ( i );
m_data.at ( i ) = ext::clone ( other.at ( i ) );
}
if constexpr ( N != 0 )
for ( size_type i = 0; i < N; ++ i ) {
delete m_data.at ( i );
m_data.at ( i ) = ext::clone ( other.at ( i ) );
}
return *this;
}
......@@ -212,8 +216,9 @@ public:
*/
template < class R >
void fill ( const R & value ) {
for ( size_type i = 0; i < N; ++ i )
m_data.at ( i ) = ext::clone ( value );
if constexpr ( N != 0 )
for ( size_type i = 0; i < N; ++ i )
m_data.at ( i ) = ext::clone ( value );
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment