1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-09-20 09:15:38 +01:00

Get rid of declarations inside constexpr functions. if constexpr warning remains

This commit is contained in:
Michael Marshall 2019-02-15 10:06:15 +00:00
parent 8cb96cb693
commit e8bd8767c0

View File

@ -120,16 +120,7 @@ namespace Grid {
static constexpr std::size_t Dimension(unsigned int dim) {
return ( dim == 0 ) ? N : Traits<T>::Dimension(dim - 1); }
static constexpr std::size_t DimensionNT(unsigned int dim) {
std::size_t DimSize = N;
bool bGotDimSize = false;
if( N != 1 ) {
if( dim == 0 )
bGotDimSize = true;
dim--;
}
if( !bGotDimSize )
DimSize = Traits<T>::DimensionNT(dim);
return DimSize;
return ( N == 1 ) ? Traits<T>::DimensionNT(dim) : ( dim == 0 ) ? N : Traits<T>::DimensionNT(dim - 1);
}
};
template <typename T, int N> struct Traits<iMatrix<T, N>> {
@ -143,16 +134,7 @@ namespace Grid {
static constexpr std::size_t Dimension(unsigned int dim) {
return ( dim == 0 || dim == 1 ) ? N : Traits<T>::Dimension(dim - 2); }
static constexpr std::size_t DimensionNT(unsigned int dim) {
std::size_t DimSize = N;
bool bGotDimSize = false;
if( N != 1 ) {
if( dim == 0 || dim == 1 )
bGotDimSize = true;
dim -= 2;
}
if( !bGotDimSize )
DimSize = Traits<T>::DimensionNT(dim);
return DimSize;
return ( N == 1 ) ? Traits<T>::DimensionNT(dim) : ( dim == 0 || dim == 1 ) ? N : Traits<T>::DimensionNT(dim - 2);
}
};
template <typename T, int N> struct Traits<std::array<T, N>> : Traits<iVector<T, N>> {};