aboutsummaryrefslogtreecommitdiffstats
path: root/include/iterator_range.h
diff options
context:
space:
mode:
authorGravatar Sadie Powell2020-11-11 02:25:06 +0000
committerGravatar Sadie Powell2020-11-11 02:29:36 +0000
commit2d6d47b489d733ca3c29fc2f963d424029fcb929 (patch)
treefa38bdd2dcbebdb126d29482bfb7d5389a10c2d4 /include/iterator_range.h
parentConvert FOREACH_MOD_CUSTOM to a variadic function. (diff)
downloadinspircd++-2d6d47b489d733ca3c29fc2f963d424029fcb929.tar.gz
inspircd++-2d6d47b489d733ca3c29fc2f963d424029fcb929.tar.bz2
inspircd++-2d6d47b489d733ca3c29fc2f963d424029fcb929.zip
Add stdalgo::equal_range and switch more stuff to iterator_range.
Diffstat (limited to 'include/iterator_range.h')
-rw-r--r--include/iterator_range.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/iterator_range.h b/include/iterator_range.h
index 86aac4e7b..e760646d5 100644
--- a/include/iterator_range.h
+++ b/include/iterator_range.h
@@ -23,8 +23,19 @@ namespace stdalgo
{
template <typename Iterator>
class iterator_range;
+
+ /** Returns a range containing all elements equivalent to \p value.
+ * @param collection The collection to search within.
+ * @param value The value to search for.
+ */
+ template <typename Collection, typename Value>
+ iterator_range<typename Collection::const_iterator> equal_range(const Collection& collection, const Value& value)
+ {
+ return collection.equal_range(value);
+ }
}
+/** Represents a range of iterators. */
template <typename Iterator>
class stdalgo::iterator_range
{