diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:19:14 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:19:14 +0200 |
commit | 01eb8253196672c969a39587e90b49321a182428 (patch) | |
tree | 4a3b71d7913de519744466c9227fda6461c4f0b5 /zen/stl_tools.h | |
parent | 5.0 (diff) | |
download | FreeFileSync-01eb8253196672c969a39587e90b49321a182428.tar.gz FreeFileSync-01eb8253196672c969a39587e90b49321a182428.tar.bz2 FreeFileSync-01eb8253196672c969a39587e90b49321a182428.zip |
5.1
Diffstat (limited to 'zen/stl_tools.h')
-rw-r--r-- | zen/stl_tools.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/zen/stl_tools.h b/zen/stl_tools.h index 03a10f96..e9fe149a 100644 --- a/zen/stl_tools.h +++ b/zen/stl_tools.h @@ -9,6 +9,7 @@ #define STL_TOOLS_HEADER_84567184321434 #include <memory> +#include <algorithm> #if defined _MSC_VER && _MSC_VER <= 1600 #include <set> #include <map> @@ -111,17 +112,14 @@ ForwardIterator binary_search(ForwardIterator first, ForwardIterator last, const template <class BidirectionalIterator, class T> inline BidirectionalIterator find_last(const BidirectionalIterator first, BidirectionalIterator last, const T& value) { - //reverse iteration: 1. check 2. decrement 3. evaluate - const BidirectionalIterator iterNotFound = last; - for (;;) //VS 2010 doesn't like "while (true)" + for (BidirectionalIterator iter = last; iter != first;) //reverse iteration: 1. check 2. decrement 3. evaluate { - if (last == first) - return iterNotFound; - --last; + --iter; // - if (*last == value) - return last; + if (*iter == value) + return iter; } + return last; } |