From e4b2d5d232251c26a650e72924f6635e31958074 Mon Sep 17 00:00:00 2001 From: kronbichler Date: Thu, 23 Dec 2010 23:31:19 +0000 Subject: [PATCH] Fix compile problem on older compilers. git-svn-id: https://svn.dealii.org/trunk@23070 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/base/index_set.h | 39 ++++++++++++++++-------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/deal.II/include/deal.II/base/index_set.h b/deal.II/include/deal.II/base/index_set.h index fe0940cee6..1a17164e81 100644 --- a/deal.II/include/deal.II/base/index_set.h +++ b/deal.II/include/deal.II/base/index_set.h @@ -780,12 +780,20 @@ IndexSet::nth_index_in_set (const unsigned int n) const // subdivide the ranges Range r (n,n+1); r.nth_index_in_set = n; + std::vector::const_iterator range_begin, range_end; + if (nnth_index_in_set) + { + range_begin = ranges.begin(); + range_end = main_range; + } + else + { + range_begin = main_range + 1; + range_end = ranges.end(); + } + std::vector::const_iterator - p = std::lower_bound(nnth_index_in_set ? - ranges.begin() : ++main_range, - nnth_index_in_set ? - main_range : ranges.end(), - r, + p = std::lower_bound(range_begin, range_end, r, Range::nth_index_compare); if (p != ranges.end()) @@ -818,14 +826,21 @@ IndexSet::index_within_set (const unsigned int n) const return (n-main_range->begin) + main_range->nth_index_in_set; Range r(n, n); + std::vector::const_iterator range_begin, range_end; + if (nbegin) + { + range_begin = ranges.begin(); + range_end = main_range; + } + else + { + range_begin = main_range + 1; + range_end = ranges.end(); + } - std::vector::const_iterator - p = std::lower_bound(nbegin ? - ranges.begin() : ++main_range, - nbegin ? - main_range : ranges.end(), - r, - Range::end_compare); + std::vector::const_iterator + p = std::lower_bound(range_begin, range_end, r, + Range::end_compare); Assert(p!=ranges.end(), ExcInternalError()); Assert(p->begin<=n, ExcInternalError()); -- 2.39.5