Fix for_each

This commit is contained in:
Simon Giraudot 2020-03-18 09:11:41 +01:00
parent 61b51605b2
commit 61d331f456
2 changed files with 5 additions and 5 deletions

View File

@ -41,7 +41,7 @@ void for_each (RangeRef range,
{ {
functor(r); functor(r);
} }
catch (stop_for_each) catch (const stop_for_each&)
{ {
break; break;
} }
@ -70,7 +70,7 @@ void for_each (RangeRef range,
{ {
functor (*(iterators[i])); functor (*(iterators[i]));
} }
catch (stop_for_each) catch (const stop_for_each&)
{ {
return; return;
} }
@ -78,7 +78,7 @@ void for_each (RangeRef range,
} }
template <typename RangeRef> template <typename RangeRef>
void for_each (const RangeRef range, void for_each (RangeRef range,
const std::function<void(typename std::iterator_traits const std::function<void(typename std::iterator_traits
<typename Range_iterator_type<RangeRef>::type>::reference)>& functor, <typename Range_iterator_type<RangeRef>::type>::reference)>& functor,
const Parallel_tag&, const Parallel_tag&,
@ -94,7 +94,7 @@ void for_each (const RangeRef range,
{ {
functor (*(range.begin() + i)); functor (*(range.begin() + i));
} }
catch (stop_for_each) catch (const stop_for_each&)
{ {
return; return;
} }

View File

@ -1474,7 +1474,7 @@ dispatch_or_drop_output(O... o)
// Trick to select iterator or const_iterator depending on the range constness // Trick to select iterator or const_iterator depending on the range constness
template <typename RangeRef> template <typename RangeRef>
struct Range_iterator_type { typedef int type; }; // Should generate errors struct Range_iterator_type;
template <typename RangeRef> template <typename RangeRef>
struct Range_iterator_type<RangeRef&> { typedef typename RangeRef::iterator type; }; struct Range_iterator_type<RangeRef&> { typedef typename RangeRef::iterator type; };
template <typename RangeRef> template <typename RangeRef>