-
Couldn't load subscription status.
- Fork 2
Range helpers
The range helpers are included as part of meta_reader.h and they exist in the xlang::meta::reader namespace.
There are two groups of range helpers.: Range collection adapters and range searching functions.
These methods operate primarily on ranges that are represented as a pair of iterators: std::pair<T, T>.
template<typename T>
T const& begin(std::pair<T, T> const& values) noexcept;
template<typename T>
T const& end(std::pair<T, T> const& values) noexcept;The begin function returns the start of the range.
The end function returns the end of the range.
These methods exist in the xlang::meta::reader namespace
so that they can be found via
argument dependent lookup,
thereby permitting the use of
range-based for loops.
template<typename T>
difference_type const& distance(std::pair<T, T> const& values) noexcept;The distance function returns the number of elements in the range.
template<typename Container, typename T>
std::pair<T, T> equal_range(Container const& container, T const& value) noexcept;
template<typename Container, typename T, typename Compare>
std::pair<T, T> equal_range(Container const& container, T const& value, Compare compare) noexcept;
This is convenience wrapper around std::equal_range which searches the entire container.
The equal_range function extracts the subrange of the provided container whose values match the specified value. The incoming range must be sorted.
If you pass an optional comparison functor, it is used to determine equality. The provided container must be sorted with respect to that comparer.
The container is typically a std::pair<T, T>, but it can be anything that supports begin, end, and element comparison with value.