diff --git a/common/misc.hh b/common/misc.hh index b7b91f0c3cba203f08730e2c64fb472dca69deee..5746444623d1108f9e3a570cc5eaa6dce27683dc 100644 --- a/common/misc.hh +++ b/common/misc.hh @@ -1,12 +1,12 @@ // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- // vi: set et ts=4 sw=2 sts=2: +#ifndef MISC_HH +#define MISC_HH + /** \file \brief Miscellaneous helper stuff */ -#ifndef MISC_HH -#define MISC_HH - #include <iostream> #include <sstream> @@ -35,6 +35,13 @@ namespace Dune { @{ */ + //! Return the sign of the value + template <class T> + int sign(const T& val) + { + return (val < 0 ? -1 : 1); + } + /** \brief Compute the square of T */ template<class T> T SQR (T t)