]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix compile problem on older compilers.
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 23 Dec 2010 23:31:19 +0000 (23:31 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 23 Dec 2010 23:31:19 +0000 (23:31 +0000)
git-svn-id: https://svn.dealii.org/trunk@23070 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/index_set.h

index fe0940cee647f0fe38105a7cda3a7b084f46c2bd..1a17164e8115de739753b774d0168bb7c03d0834 100644 (file)
@@ -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<Range>::const_iterator range_begin, range_end;
+  if (n<main_range->nth_index_in_set)
+    {
+      range_begin = ranges.begin();
+      range_end   = main_range;
+    }
+  else
+    {
+      range_begin = main_range + 1;
+      range_end   = ranges.end();
+    }
+
   std::vector<Range>::const_iterator 
-    p = std::lower_bound(n<main_range->nth_index_in_set ?
-                        ranges.begin() : ++main_range, 
-                        n<main_range->nth_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<Range>::const_iterator range_begin, range_end;
+  if (n<main_range->begin)
+    {
+      range_begin = ranges.begin();
+      range_end   = main_range;
+    }
+  else
+    {
+      range_begin = main_range + 1;
+      range_end   = ranges.end();
+    }
 
-  std::vector<Range>::const_iterator
-      p = std::lower_bound(n<main_range->begin ?
-                          ranges.begin() : ++main_range, 
-                          n<main_range->begin ?
-                          main_range : ranges.end(),
-                          r,
-                          Range::end_compare);
+  std::vector<Range>::const_iterator 
+    p = std::lower_bound(range_begin, range_end, r,
+                        Range::end_compare);
 
   Assert(p!=ranges.end(), ExcInternalError());
   Assert(p->begin<=n, ExcInternalError());

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.