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

Modernize a bit the code using is_const_v

parent ba56a8dd
Branches
Tags
1 merge request!103Set AssertError to inherit from std::runtime_error
...@@ -60,7 +60,7 @@ class [[nodiscard]] Array ...@@ -60,7 +60,7 @@ class [[nodiscard]] Array
PUGS_INLINE PUGS_INLINE
void fill(const DataType& data) const void fill(const DataType& data) const
{ {
static_assert(not std::is_const<DataType>(), "Cannot modify Array of const"); static_assert(not std::is_const_v<DataType>, "Cannot modify Array of const");
Kokkos::deep_copy(m_values, data); Kokkos::deep_copy(m_values, data);
} }
...@@ -72,7 +72,7 @@ class [[nodiscard]] Array ...@@ -72,7 +72,7 @@ class [[nodiscard]] Array
static_assert(std::is_same<std::remove_const_t<DataType>, std::remove_const_t<DataType2>>(), static_assert(std::is_same<std::remove_const_t<DataType>, std::remove_const_t<DataType2>>(),
"Cannot assign Array of different type"); "Cannot assign Array of different type");
// ensures that const is not lost through copy // ensures that const is not lost through copy
static_assert(((std::is_const<DataType2>() and std::is_const<DataType>()) or not std::is_const<DataType2>()), static_assert(((std::is_const_v<DataType2> and std::is_const_v<DataType>) or not std::is_const_v<DataType2>),
"Cannot assign Array of const to Array of non-const"); "Cannot assign Array of const to Array of non-const");
m_values = array.m_values; m_values = array.m_values;
return *this; return *this;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment