Skip to content
Snippets Groups Projects
Commit aeb2c3b4 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

staticly checks if template parameter is an arithmetic type for

construction or assignation from 'zero'
parent 33035377
No related branches found
No related tags found
2 merge requests!2Develop,!1Develop
......@@ -112,6 +112,7 @@ public:
KOKKOS_INLINE_FUNCTION
TinyVector& operator=(const ZeroType& z)
{
static_assert(std::is_arithmetic<T>(),"Cannot assign 'zero' value for non-arithmetic types");
for (size_t i=0; i<N; ++i) {
m_values[i] = 0;
}
......@@ -147,6 +148,7 @@ public:
KOKKOS_INLINE_FUNCTION
TinyVector(const ZeroType& z)
{
static_assert(std::is_arithmetic<T>(),"Cannot construct from 'zero' value for non-arithmetic types");
for (size_t i=0; i<N; ++i) {
m_values[i] = 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment