Andrey Semashev 6cf9c22cf1 Reworked iterator handling in next/prior helpers.
The new implementation tries to detect if the incremented/decremented type
is an iterator first and if not falls back to operator probing. This way
iterators that are not SFINAE-friendly (i.e. unconditionally define
arithmetic operators regardless of the iterator category) are still treated
as iterators through std::advance and do not fail the compilation.

The iterator detection is based on probing for the nested iterator_category
type that is expected to be present in class-type iterators. This heuristic
is not flawless since iterators are not required to defined this type.
User-defined iterators may not have it and instead specialize
std::iterator_traits. This use case is not covered by the current implementation
and will likely fail to compile. With C++17 SFINAE-friendly std::iterator_traits
this can be fixed, but currently Boost.Config lacks the macro to detect
availability of this feature. Support for it can be added by a later commit.

Also simplified boost::prior for iterators, removing the possibility of
integer overflow caused by negation of the distance value.
2017-07-09 03:10:01 +03:00
2014-08-18 18:57:40 +04:00
2017-05-29 19:10:46 +03:00
2014-05-29 17:41:56 +02:00
2005-09-20 18:35:26 +00:00
Description
Boost.org utility module
3.1 MiB
Languages
C++ 84.5%
HTML 15.4%
CMake 0.1%