From 072b9f2468e99aeae916ec66cae73ce018f7018e Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Fri, 20 Jul 2018 16:20:03 +0200 Subject: [PATCH] [material][brineair] Use switch instead of static constexpr array * fixes linker error on c++14 --- dumux/material/fluidsystems/brineair.hh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dumux/material/fluidsystems/brineair.hh b/dumux/material/fluidsystems/brineair.hh index 437977735f..640df7d37b 100644 --- a/dumux/material/fluidsystems/brineair.hh +++ b/dumux/material/fluidsystems/brineair.hh @@ -117,11 +117,18 @@ private: { using FluidSystem = Brine; - static constexpr int phaseIdx(int brinePhaseIdx) { return liquidPhaseIdx; } - static constexpr int compIdx(int brineCompIdx) { return compMap[brineCompIdx]; } - private: - static constexpr std::array<int, Brine::numComponents> compMap{ {H2OIdx, NaClIdx} }; + static constexpr int phaseIdx(int brinePhaseIdx) { return liquidPhaseIdx; } + static constexpr int compIdx(int brineCompIdx) + { + switch (brineCompIdx) + { + assert(brineCompIdx == Brine::H2OIdx || brineCompIdx == Brine::NaClIdx); + case Brine::H2OIdx: return H2OIdx; + case Brine::NaClIdx: return NaClIdx; + default: return 0; // this will never be reached, only needed to suppress compiler warning + } + } }; template<class FluidState> -- GitLab