Dune Core Modules (2.9.0)

power.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 // SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
4 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5 #ifndef DUNE_COMMON_POWER_HH
6 #define DUNE_COMMON_POWER_HH
7 
8 #warning The header power.hh is deprecated. Use power from math.hh instead.
9 
14 #include <dune/common/math.hh>
15 
16 namespace Dune {
17 
26  template <int b, int p>
27  struct StaticPower
28  {
30  static constexpr int power = Dune::power(b,p);
31  };
32 
33 
40  template <int p>
41  struct Power
42  {
43  template <typename T>
44  static constexpr auto eval(const T & a)
45  {
46  return power(a,p);
47  }
48  };
49 
50 }
51 
52 #endif
static constexpr int power
power stores b^p
Definition: power.hh:30
Some useful basic math stuff.
Dune namespace.
Definition: alignedallocator.hh:13
constexpr Base power(Base m, Exponent p)
Power method for integer exponents.
Definition: math.hh:75
Compute power for a run-time base and a compile-time integer exponent.
Definition: power.hh:42
Calculates b^p at compile time.
Definition: power.hh:28
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 29, 22:29, 2024)