Adobe Source Libraries 1.49.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
find_match.hpp
Go to the documentation of this file.
1/*
2 Copyright 2013 Adobe
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5*/
6/**************************************************************************************************/
7
8#ifndef ADOBE_ALGORITHM_FIND_MATCH_HPP
9#define ADOBE_ALGORITHM_FIND_MATCH_HPP
10
11#include <adobe/config.hpp>
12
13#include <boost/range/begin.hpp>
14#include <boost/range/end.hpp>
15
16#include <algorithm>
17#include <functional>
18
19/**************************************************************************************************/
20
21namespace adobe {
22
23/**************************************************************************************************/
34/**************************************************************************************************/
40template <class InputIterator, class T, class Compare>
41inline InputIterator find_match(InputIterator first, InputIterator last, const T& value,
42 Compare comp) {
43 return std::find_if(first, last, std::bind(comp, value, std::placeholders::_1));
44}
45
51template <class InputRange, class T, class Compare>
52inline typename boost::range_iterator<InputRange>::type find_match(InputRange& range,
53 const T& value, Compare comp) {
54 return adobe::find_match(boost::begin(range), boost::end(range), value, comp);
55}
56
62template <class InputRange, class T, class Compare>
63inline typename boost::range_const_iterator<InputRange>::type
64find_match(const InputRange& range, const T& value, Compare comp) {
65 return adobe::find_match(boost::begin(range), boost::end(range), value, comp);
66}
67
73template <class InputIterator, class T, class Compare>
74inline InputIterator find_match(InputIterator first, InputIterator last, const T& value) {
75 return std::find_if(first, last, std::bind(std::equal_to<T>(), value, std::placeholders::_1));
76}
77
83template <class InputRange, class T, class Compare>
84inline typename boost::range_iterator<InputRange>::type find_match(InputRange& range,
85 const T& value) {
86 return adobe::find_match(boost::begin(range), boost::end(range), value);
87}
88
94template <class InputRange, class T, class Compare>
95inline typename boost::range_const_iterator<InputRange>::type find_match(const InputRange& range,
96 const T& value) {
97 return adobe::find_match(boost::begin(range), boost::end(range), value);
98}
99
100
101/**************************************************************************************************/
102
103} // namespace adobe
104
105/**************************************************************************************************/
106
107#endif
108
109/**************************************************************************************************/
InputIterator find_match(InputIterator first, InputIterator last, const T &value, Compare comp)
find_match implementation