Skip to content
Snippets Groups Projects
Commit 9c51fb64 authored by Steffen Müthing's avatar Steffen Müthing
Browse files

[!576] [math] deduce the return value of Power in order to allow unit value...

[!576] [math] deduce the return value of Power in order to allow unit value types (see dune-grid#79)

Merge branch 'power-auto' into 'master'

ref:core/dune-common When working with unit value types (e.g. meters, seconds,
\...) the return type of Power is not the value type. This MR changes the
return type to auto to enable automatic type deduction.

See merge request [!576]

  [!576]: gitlab.dune-project.org/core/dune-common/merge_requests/576
parents d9814da5 ad05c31f
Branches
Tags
1 merge request!576[math] deduce the return value of Power in order to allow unit value types (see dune-grid#79)
Pipeline #14147 passed
......@@ -46,7 +46,7 @@ namespace Dune {
struct Power
{
template <typename T>
static constexpr T eval(const T & a)
static constexpr auto eval(const T & a)
{
return PowerImp<p>::eval(a);
}
......@@ -57,9 +57,9 @@ namespace Dune {
struct PowerImp<p,false>
{
template <typename T>
static constexpr T eval(const T & a)
static constexpr auto eval(const T & a)
{
T t = Power<p/2>::eval(a);
auto t = Power<p/2>::eval(a);
return t*t;
}
};
......@@ -68,7 +68,7 @@ namespace Dune {
struct PowerImp<p,true>
{
template <typename T>
static constexpr T eval(const T & a)
static constexpr auto eval(const T & a)
{
return a*Power<p-1>::eval(a);;
}
......@@ -78,7 +78,7 @@ namespace Dune {
struct PowerImp<1,true>
{
template <typename T>
static constexpr T eval(const T & a)
static constexpr auto eval(const T & a)
{
return a;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment