mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-20 14:52:10 +00:00
[util][range] Fix back()
*(--boost::end(rng)); is not valid for range with pointer as iterators. since the range is supposed to be BidirectionalRange, use rbegin instead.
This commit is contained in:
@@ -138,7 +138,7 @@ back(BidirectionalRange const& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( boost::BidirectionalRangeConcept<BidirectionalRange const> ));
|
||||
BOOST_ASSERT(!boost::empty(rng));
|
||||
return *(--boost::end(rng));
|
||||
return *(boost::rbegin(rng));
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -151,7 +151,7 @@ back(BidirectionalRange & rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( boost::BidirectionalRangeConcept<BidirectionalRange> ));
|
||||
BOOST_ASSERT(!boost::empty(rng));
|
||||
return *(--boost::end(rng));
|
||||
return *(boost::rbegin(rng));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user