Skip to content
Snippets Groups Projects
Commit 1c96e86f authored by Oliver Sander's avatar Oliver Sander
Browse files

Implement operator*= such that it accepts any number type

This is possible now because we have IsNumber in dune-common.
parent 09c4d040
Branches
Tags
1 merge request!282Improve matrix testing
......@@ -159,31 +159,11 @@ namespace Dune {
});
}
// Once we have the IsNumber traits class the following
// three implementations could be replaced by:
//
// template<class T,
// std::enable_if_t< IsNumber<T>::value, int> = 0>
// void operator*= (const T& w) {
// Dune::Hybrid::forEach(*this, [&](auto&& entry) {
// entry *= w;
// });
// }
void operator*= (const int& w) {
Dune::Hybrid::forEach(*this, [&](auto&& entry) {
entry *= w;
});
}
void operator*= (const float& w) {
Dune::Hybrid::forEach(*this, [&](auto&& entry) {
entry *= w;
});
}
void operator*= (const double& w) {
Dune::Hybrid::forEach(*this, [&](auto&& entry) {
/** \brief Multiplication with a scalar */
template<class T,
std::enable_if_t< IsNumber<T>::value, int> = 0>
void operator*= (const T& w) {
Hybrid::forEach(*this, [&](auto&& entry) {
entry *= w;
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment