dune-common  2.3.1-rc1
lcm.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 #ifndef DUNE_LCM_HH
4 #define DUNE_LCM_HH
5 
11 #include <dune/common/gcd.hh>
12 
13 namespace Dune
14 {
15 
29  template<long m, long n>
30  struct Lcm
31  {
32  static void conceptCheck()
33  {
34  dune_static_assert(0<m, "m must be positive!");
35  dune_static_assert(0<n, "n must be positive!");
36  }
41  const static long value = (m/Gcd<m,n>::value)*n;
42  };
43 }
44 
45 #endif
Calculator of the greatest common divisor.
Definition: gcd.hh:66
Statically compute the greatest common divisor of two integers.
#define dune_static_assert(COND, MSG)
Helper template so that compilation fails if condition is not true.
Definition: static_assert.hh:79
Calculate the least common multiple of two numbers.
Definition: lcm.hh:30
Fallback implementation of the C++0x static_assert feature.
static void conceptCheck()
Definition: lcm.hh:32
static const long value
The least common multiple of the template parameters m and n.
Definition: lcm.hh:41