From a174d4eb51e7443cd735d7b28a3c66452bc079d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Wed, 8 May 2013 19:21:09 +0200 Subject: [PATCH] Put spdiag() into an anonymous namespace. This avoids warnings (GCC 4.6) about missing prior function declaration. --- AutoDiffHelpers.hpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/AutoDiffHelpers.hpp b/AutoDiffHelpers.hpp index 3e6c063c3..928fe64d4 100644 --- a/AutoDiffHelpers.hpp +++ b/AutoDiffHelpers.hpp @@ -248,19 +248,21 @@ subset(const Eigen::Array& x, } -AutoDiff::ForwardBlock::M -spdiag(const AutoDiff::ForwardBlock::V& d) -{ - typedef AutoDiff::ForwardBlock::M M; +namespace { + AutoDiff::ForwardBlock::M + spdiag(const AutoDiff::ForwardBlock::V& d) + { + typedef AutoDiff::ForwardBlock::M M; - const int n = d.size(); - M mat(n, n); - mat.reserve(Eigen::ArrayXi::Ones(n, 1)); - for (M::Index i = 0; i < n; ++i) { - mat.insert(i, i) = d[i]; + const int n = d.size(); + M mat(n, n); + mat.reserve(Eigen::ArrayXi::Ones(n, 1)); + for (M::Index i = 0; i < n; ++i) { + mat.insert(i, i) = d[i]; + } + + return mat; } - - return mat; -} +} // Anonymous namespace #endif // OPM_AUTODIFFHELPERS_HEADER_INCLUDED