From 09f458f5ee7bacab419caa191fb50d837521b12a Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Wed, 24 Oct 2012 21:14:24 +0200 Subject: [PATCH] Remove superfluous construction by std::make_pair Since we know the type of the components, we may just as well create the pair directly! (Using make_pair invokes compiler bugs in GCC). --- opm/core/wells/WellsGroup.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/opm/core/wells/WellsGroup.cpp b/opm/core/wells/WellsGroup.cpp index e1bed0cb..8c541431 100644 --- a/opm/core/wells/WellsGroup.cpp +++ b/opm/core/wells/WellsGroup.cpp @@ -762,27 +762,16 @@ namespace Opm } } -// macro to insert const_cast to get a round bug in GCC 4.6.3 where it -// suddenly believes that "this" is a const pointer, although we are not -// in a const method. -#if ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ == 6 ) && ( __GNUC_PATCHLEVEL__ == 3 ) -#define CONST_CAST(T,v) const_cast(v) -#else -#define CONST_CAST(T,v) v -#endif - std::pair WellNode::getWorstOffending(const std::vector& well_reservoirrates_phase, const std::vector& well_surfacerates_phase, ProductionSpecification::ControlMode mode) { const int np = phaseUsage().num_phases; const int index = self_index_*np; - // note: CONST_CAST is just to work around a bug in GCC 4.6.3; it - // is not really needed, and should be a harmless no-op. - return std::make_pair(CONST_CAST(WellNode*,this), - rateByMode(&well_reservoirrates_phase[index], - &well_surfacerates_phase[index], - mode)); + return std::pair(this, + rateByMode(&well_reservoirrates_phase[index], + &well_surfacerates_phase[index], + mode)); } void WellNode::applyInjGroupControl(const InjectionSpecification::ControlMode control_mode,