namespace std {
template <class F, class... Args>
invoke_result_t<F, Args...> invoke(F&& f, Args&&... args)
noexcept(is_nothrow_invocable_v<F, Args...>);
template <class T> class reference_wrapper;
template <class T> reference_wrapper<T> ref(T&) noexcept;
template <class T> reference_wrapper<const T> cref(const T&) noexcept;
template <class T> void ref(const T&&) = delete;
template <class T> void cref(const T&&) = delete;
template <class T> reference_wrapper<T> ref(reference_wrapper<T>) noexcept;
template <class T> reference_wrapper<const T> cref(reference_wrapper<T>) noexcept;
template <class T = void> struct plus;
template <class T = void> struct minus;
template <class T = void> struct multiplies;
template <class T = void> struct divides;
template <class T = void> struct modulus;
template <class T = void> struct negate;
template <> struct plus<void>;
template <> struct minus<void>;
template <> struct multiplies<void>;
template <> struct divides<void>;
template <> struct modulus<void>;
template <> struct negate<void>;
template <class T = void> struct equal_to;
template <class T = void> struct not_equal_to;
template <class T = void> struct greater;
template <class T = void> struct less;
template <class T = void> struct greater_equal;
template <class T = void> struct less_equal;
template <> struct equal_to<void>;
template <> struct not_equal_to<void>;
template <> struct greater<void>;
template <> struct less<void>;
template <> struct greater_equal<void>;
template <> struct less_equal<void>;
template <class T = void> struct logical_and;
template <class T = void> struct logical_or;
template <class T = void> struct logical_not;
template <> struct logical_and<void>;
template <> struct logical_or<void>;
template <> struct logical_not<void>;
template <class T = void> struct bit_and;
template <class T = void> struct bit_or;
template <class T = void> struct bit_xor;
template <class T = void> struct bit_not;
template <> struct bit_and<void>;
template <> struct bit_or<void>;
template <> struct bit_xor<void>;
template <> struct bit_not<void>;
template <class F>
unspecified not_fn(F&& f);
template<class T> struct is_bind_expression;
template<class T> struct is_placeholder;
template<class F, class... BoundArgs>
unspecified bind(F&&, BoundArgs&&...);
template<class R, class F, class... BoundArgs>
unspecified bind(F&&, BoundArgs&&...);
namespace placeholders {
see below _1;
see below _2;
.
.
.
see below _M;
}
template<class R, class T>
unspecified mem_fn(R T::*) noexcept;
class bad_function_call;
template<class> class function; template<class R, class... ArgTypes> class function<R(ArgTypes...)>;
template<class R, class... ArgTypes>
void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&) noexcept;
template<class R, class... ArgTypes>
bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
template<class R, class... ArgTypes>
bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
template<class R, class... ArgTypes>
bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
template<class R, class... ArgTypes>
bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
template<class ForwardIterator, class BinaryPredicate = equal_to<>>
class default_searcher;
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
class boyer_moore_searcher;
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
class boyer_moore_horspool_searcher;
template <class T>
struct hash;
template <class T>
inline constexpr bool is_bind_expression_v = is_bind_expression<T>::value;
template <class T>
inline constexpr int is_placeholder_v = is_placeholder<T>::value;
}
[
Example: If a C++ program wants to have a by-element addition of two vectors a
and b containing double and put the result into a,
it can do:
transform(a.begin(), a.end(), b.begin(), a.begin(), plus<double>());
—
end example ]
[
Example: To negate every element of a:
transform(a.begin(), a.end(), a.begin(), negate<double>());
—
end example ]
23.14.5 Class template reference_wrapper [refwrap]
namespace std {
template <class T> class reference_wrapper {
public :
using type = T;
reference_wrapper(T&) noexcept;
reference_wrapper(T&&) = delete; reference_wrapper(const reference_wrapper& x) noexcept;
reference_wrapper& operator=(const reference_wrapper& x) noexcept;
operator T& () const noexcept;
T& get() const noexcept;
template <class... ArgTypes>
invoke_result_t<T&, ArgTypes...>
operator() (ArgTypes&&...) const;
};
template<class T>
reference_wrapper(reference_wrapper<T>) -> reference_wrapper<T>;
}
reference_wrapper<T> is a
CopyConstructible and
CopyAssignable wrapper
around a reference to an object or function of type
T. reference_wrapper<T> shall be a trivially copyable type (
[basic.types])
. reference_wrapper(T& t) noexcept;
Effects: Constructs a
reference_wrapper object that stores a
reference to
t. reference_wrapper(const reference_wrapper& x) noexcept;
Effects: Constructs a
reference_wrapper object that
stores a reference to
x.get(). reference_wrapper& operator=(const reference_wrapper& x) noexcept;
Postconditions: *this stores a reference to
x.get(). operator T& () const noexcept;
Returns: The stored reference
. T& get() const noexcept;
Returns: The stored reference
. template <class... ArgTypes>
invoke_result_t<T&, ArgTypes...>
operator()(ArgTypes&&... args) const;
Returns: INVOKE(get(), std::forward<ArgTypes>(args)...). template <class T> reference_wrapper<T> ref(T& t) noexcept;
Returns: reference_wrapper<T>(t). template <class T> reference_wrapper<T> ref(reference_wrapper<T> t) noexcept;
template <class T> reference_wrapper<const T> cref(const T& t) noexcept;
Returns: reference_wrapper <const T>(t). template <class T> reference_wrapper<const T> cref(reference_wrapper<T> t) noexcept;
The library provides basic function object classes for all of the arithmetic
operators in the language (
[expr.mul],
[expr.add])
.template <class T = void> struct plus {
constexpr T operator()(const T& x, const T& y) const;
};
constexpr T operator()(const T& x, const T& y) const;
template <> struct plus<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) + std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) + std::forward<U>(u));
Returns: std::forward<T>(t) + std::forward<U>(u). template <class T = void> struct minus {
constexpr T operator()(const T& x, const T& y) const;
};
constexpr T operator()(const T& x, const T& y) const;
template <> struct minus<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) - std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) - std::forward<U>(u));
Returns: std::forward<T>(t) - std::forward<U>(u). template <class T = void> struct multiplies {
constexpr T operator()(const T& x, const T& y) const;
};
constexpr T operator()(const T& x, const T& y) const;
template <> struct multiplies<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) * std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) * std::forward<U>(u));
Returns: std::forward<T>(t) * std::forward<U>(u). template <class T = void> struct divides {
constexpr T operator()(const T& x, const T& y) const;
};
constexpr T operator()(const T& x, const T& y) const;
template <> struct divides<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) / std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) / std::forward<U>(u));
Returns: std::forward<T>(t) / std::forward<U>(u). template <class T = void> struct modulus {
constexpr T operator()(const T& x, const T& y) const;
};
constexpr T operator()(const T& x, const T& y) const;
template <> struct modulus<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) % std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) % std::forward<U>(u));
Returns: std::forward<T>(t) % std::forward<U>(u). template <class T = void> struct negate {
constexpr T operator()(const T& x) const;
};
constexpr T operator()(const T& x) const;
template <> struct negate<void> {
template <class T> constexpr auto operator()(T&& t) const
-> decltype(-std::forward<T>(t));
using is_transparent = unspecified;
};
template <class T> constexpr auto operator()(T&& t) const
-> decltype(-std::forward<T>(t));
Returns: -std::forward<T>(t). The library provides basic function object classes for all of the comparison
operators in the language (
[expr.rel],
[expr.eq])
.For templates
less,
greater,
less_equal, and
greater_equal, the specializations for any pointer type
yield a strict total order that is consistent among those specializations and
is also consistent with the partial order imposed by
the built-in operators
<,
>,
<=,
>=. [
Note: When
a < b is well-defined
for pointers
a and
b of type
P,
this implies
(a < b) == less<P>(a, b),
(a > b) == greater<P>(a, b), and so forth
. —
end note ]
For template specializations
less<void>,
greater<void>,
less_equal<void>, and
greater_equal<void>,
if the call operator calls a built-in operator comparing pointers,
the call operator yields a strict total order
that is consistent among those specializations and
is also consistent with the partial order imposed by those built-in operators
.template <class T = void> struct equal_to {
constexpr bool operator()(const T& x, const T& y) const;
};
constexpr bool operator()(const T& x, const T& y) const;
template <> struct equal_to<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) == std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) == std::forward<U>(u));
Returns: std::forward<T>(t) == std::forward<U>(u). template <class T = void> struct not_equal_to {
constexpr bool operator()(const T& x, const T& y) const;
};
constexpr bool operator()(const T& x, const T& y) const;
template <> struct not_equal_to<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) != std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) != std::forward<U>(u));
Returns: std::forward<T>(t) != std::forward<U>(u). template <class T = void> struct greater {
constexpr bool operator()(const T& x, const T& y) const;
};
constexpr bool operator()(const T& x, const T& y) const;
template <> struct greater<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) > std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) > std::forward<U>(u));
Returns: std::forward<T>(t) > std::forward<U>(u). template <class T = void> struct less {
constexpr bool operator()(const T& x, const T& y) const;
};
constexpr bool operator()(const T& x, const T& y) const;
template <> struct less<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) < std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) < std::forward<U>(u));
Returns: std::forward<T>(t) < std::forward<U>(u). template <class T = void> struct greater_equal {
constexpr bool operator()(const T& x, const T& y) const;
};
constexpr bool operator()(const T& x, const T& y) const;
template <> struct greater_equal<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) >= std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) >= std::forward<U>(u));
Returns: std::forward<T>(t) >= std::forward<U>(u). template <class T = void> struct less_equal {
constexpr bool operator()(const T& x, const T& y) const;
};
constexpr bool operator()(const T& x, const T& y) const;
template <> struct less_equal<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) <= std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) <= std::forward<U>(u));
Returns: std::forward<T>(t) <= std::forward<U>(u). template <class T = void> struct logical_and {
constexpr bool operator()(const T& x, const T& y) const;
};
constexpr bool operator()(const T& x, const T& y) const;
template <> struct logical_and<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) && std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) && std::forward<U>(u));
Returns: std::forward<T>(t) && std::forward<U>(u). template <class T = void> struct logical_or {
constexpr bool operator()(const T& x, const T& y) const;
};
constexpr bool operator()(const T& x, const T& y) const;
template <> struct logical_or<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) || std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) || std::forward<U>(u));
Returns: std::forward<T>(t) || std::forward<U>(u). template <class T = void> struct logical_not {
constexpr bool operator()(const T& x) const;
};
constexpr bool operator()(const T& x) const;
template <> struct logical_not<void> {
template <class T> constexpr auto operator()(T&& t) const
-> decltype(!std::forward<T>(t));
using is_transparent = unspecified;
};
template <class T> constexpr auto operator()(T&& t) const
-> decltype(!std::forward<T>(t));
Returns: !std::forward<T>(t). template <class T = void> struct bit_and {
constexpr T operator()(const T& x, const T& y) const;
};
constexpr T operator()(const T& x, const T& y) const;
template <> struct bit_and<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) & std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) & std::forward<U>(u));
Returns: std::forward<T>(t) & std::forward<U>(u). template <class T = void> struct bit_or {
constexpr T operator()(const T& x, const T& y) const;
};
constexpr T operator()(const T& x, const T& y) const;
template <> struct bit_or<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) | std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) | std::forward<U>(u));
Returns: std::forward<T>(t) | std::forward<U>(u). template <class T = void> struct bit_xor {
constexpr T operator()(const T& x, const T& y) const;
};
constexpr T operator()(const T& x, const T& y) const;
template <> struct bit_xor<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) ^ std::forward<U>(u));
using is_transparent = unspecified;
};
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) ^ std::forward<U>(u));
Returns: std::forward<T>(t) ^ std::forward<U>(u). template <class T = void> struct bit_not {
constexpr T operator()(const T& x) const;
};
constexpr T operator()(const T& x) const;
template <> struct bit_not<void> {
template <class T> constexpr auto operator()(T&& t) const
-> decltype(~std::forward<T>(t));
using is_transparent = unspecified;
};
template <class T> constexpr auto operator()(T&&) const
-> decltype(~std::forward<T>(t));
Returns: ~std::forward<T>(t). template <class F> unspecified not_fn(F&& f);
Effects:
Equivalent to
return call_wrapper(std::forward<F>(f));
where
call_wrapper is an exposition only class defined as follows:
class call_wrapper {
using FD = decay_t<F>;
FD fd;
explicit call_wrapper(F&& f);
public:
call_wrapper(call_wrapper&&) = default;
call_wrapper(const call_wrapper&) = default;
template<class... Args>
auto operator()(Args&&...) &
-> decltype(!declval<invoke_result_t<FD&, Args...>>());
template<class... Args>
auto operator()(Args&&...) const&
-> decltype(!declval<invoke_result_t<const FD&, Args...>>());
template<class... Args>
auto operator()(Args&&...) &&
-> decltype(!declval<invoke_result_t<FD, Args...>>());
template<class... Args>
auto operator()(Args&&...) const&&
-> decltype(!declval<invoke_result_t<const FD, Args...>>());
};
explicit call_wrapper(F&& f);
Requires:
FD shall satisfy the requirements of
MoveConstructible. is_constructible_v<FD, F> shall be
true. Effects:
Initializes
fd from
std::forward<F>(f). Throws:
Any exception thrown by construction of
fd. template<class... Args>
auto operator()(Args&&... args) &
-> decltype(!declval<invoke_result_t<FD&, Args...>>());
template<class... Args>
auto operator()(Args&&... args) const&
-> decltype(!declval<invoke_result_t<const FD&, Args...>>());
Effects:
Equivalent to:
return !INVOKE(fd, std::forward<Args>(args)...);
template<class... Args>
auto operator()(Args&&... args) &&
-> decltype(!declval<invoke_result_t<FD, Args...>>());
template<class... Args>
auto operator()(Args&&... args) const&&
-> decltype(!declval<invoke_result_t<const FD, Args...>>());
Effects:
Equivalent to:
return !INVOKE(std::move(fd), std::forward<Args>(args)...);
This subclause provides function object types (
[function.objects]) for
operations that search for a sequence
[pat_first, pat_last) in another
sequence
[first, last) that is provided to the object's function call
operator
. The first sequence (the pattern to be searched for) is provided to
the object's constructor, and the second (the sequence to be searched) is
provided to the function call operator
.Each specialization of a class template specified in this subclause
[func.search] shall meet the
CopyConstructible and
CopyAssignable requirements
. The Boyer-Moore searcher implements the Boyer-Moore search algorithm
. The Boyer-Moore-Horspool searcher implements the Boyer-Moore-Horspool search algorithm
. In general, the Boyer-Moore searcher will use more memory and give better runtime performance than Boyer-Moore-Horspool
.
template <class ForwardIterator1, class BinaryPredicate = equal_to<>>
class default_searcher {
public:
default_searcher(ForwardIterator1 pat_first, ForwardIterator1 pat_last,
BinaryPredicate pred = BinaryPredicate());
template <class ForwardIterator2>
pair<ForwardIterator2, ForwardIterator2>
operator()(ForwardIterator2 first, ForwardIterator2 last) const;
private:
ForwardIterator1 pat_first_; ForwardIterator1 pat_last_; BinaryPredicate pred_; };
default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
BinaryPredicate pred = BinaryPredicate());
Effects:
Constructs a
default_searcher object, initializing
pat_first_
with
pat_first,
pat_last_ with
pat_last, and
pred_ with
pred. Throws:
Any exception thrown by the copy constructor of
BinaryPredicate or
ForwardIterator1. template<class ForwardIterator2>
pair<ForwardIterator2, ForwardIterator2>
operator()(ForwardIterator2 first, ForwardIterator2 last) const;
Effects:
Returns a pair of iterators
i and
j such that
i == search(first, last, pat_first_, pat_last_, pred_), and
if
i == last, then
j == last,
otherwise
j == next(i, distance(pat_first_, pat_last_)).
template <class RandomAccessIterator1,
class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
class BinaryPredicate = equal_to<>>
class boyer_moore_searcher {
public:
boyer_moore_searcher(RandomAccessIterator1 pat_first,
RandomAccessIterator1 pat_last,
Hash hf = Hash(),
BinaryPredicate pred = BinaryPredicate());
template <class RandomAccessIterator2>
pair<RandomAccessIterator2, RandomAccessIterator2>
operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
private:
RandomAccessIterator1 pat_first_; RandomAccessIterator1 pat_last_; Hash hash_; BinaryPredicate pred_; };
boyer_moore_searcher(RandomAccessIterator1 pat_first,
RandomAccessIterator1 pat_last,
Hash hf = Hash(),
BinaryPredicate pred = BinaryPredicate());
Requires:
The value type of
RandomAccessIterator1 shall meet the
DefaultConstructible requirements,
the
CopyConstructible requirements, and the
CopyAssignable requirements
. Requires:
For any two values
A and
B of the type
iterator_traits<RandomAccessIterator1>::value_type,
if
pred(A, B) == true, then
hf(A) == hf(B) shall be
true. Effects:
Constructs a
boyer_moore_searcher object, initializing
pat_first_ with
pat_first,
pat_last_ with
pat_last,
hash_ with
hf, and
pred_ with
pred. Throws:
Any exception thrown by the copy constructor of
RandomAccessIterator1,
or by the default constructor, copy constructor, or the copy assignment operator of the value type of
RandomAccessIterator1,
or the copy constructor or
operator() of
BinaryPredicate or
Hash. May throw
bad_alloc if additional memory needed for internal data structures cannot be allocated
.template <class RandomAccessIterator2>
pair<RandomAccessIterator2, RandomAccessIterator2>
operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
Requires:
RandomAccessIterator1 and
RandomAccessIterator2 shall have the same value type
. Effects:
Finds a subsequence of equal values in a sequence
. Returns:
A pair of iterators
i and
j such that
i is the first iterator
in the range [first, last - (pat_last_ - pat_first_)) such that
for every non-negative integer n less than pat_last_ - pat_first_
the following condition holds:
pred(*(i + n), *(pat_first_ + n)) != false, and
j == next(i, distance(pat_first_, pat_last_)).
Returns
make_pair(first, first) if
[pat_first_, pat_last_) is empty,
otherwise returns
make_pair(last, last) if no such iterator is found
.Complexity:
At most
(last - first) * (pat_last_ - pat_first_) applications of the predicate
.
template <class RandomAccessIterator1,
class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
class BinaryPredicate = equal_to<>>
class boyer_moore_horspool_searcher {
public:
boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first,
RandomAccessIterator1 pat_last,
Hash hf = Hash(),
BinaryPredicate pred = BinaryPredicate());
template <class RandomAccessIterator2>
pair<RandomAccessIterator2, RandomAccessIterator2>
operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
private:
RandomAccessIterator1 pat_first_; RandomAccessIterator1 pat_last_; Hash hash_; BinaryPredicate pred_; };
boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first,
RandomAccessIterator1 pat_last,
Hash hf = Hash(),
BinaryPredicate pred = BinaryPredicate());
Requires:
The value type of
RandomAccessIterator1 shall meet the
DefaultConstructible,
CopyConstructible, and
CopyAssignable requirements
. Requires:
For any two values
A and
B of the type
iterator_traits<RandomAccessIterator1>::value_type,
if
pred(A, B) == true, then
hf(A) == hf(B) shall be
true. Effects:
Constructs a
boyer_moore_horspool_searcher object, initializing
pat_first_ with
pat_first,
pat_last_ with
pat_last,
hash_ with
hf, and
pred_ with
pred. Throws:
Any exception thrown by the copy constructor of
RandomAccessIterator1,
or by the default constructor, copy constructor, or the copy assignment operator of the value type of
RandomAccessIterator1
or the copy constructor or
operator() of
BinaryPredicate or
Hash. May throw
bad_alloc if additional memory needed for internal data structures cannot be allocated
.template <class RandomAccessIterator2>
pair<RandomAccessIterator2, RandomAccessIterator2>
operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
Requires:
RandomAccessIterator1 and
RandomAccessIterator2 shall have the same value type
. Effects:
Finds a subsequence of equal values in a sequence
. Returns:
A pair of iterators
i and
j such that
i is the first iterator i in the range
[first, last - (pat_last_ - pat_first_)) such that
for every non-negative integer n less than pat_last_ - pat_first_
the following condition holds:
pred(*(i + n), *(pat_first_ + n)) != false, and
j == next(i, distance(pat_first_, pat_last_)).
Returns
make_pair(first, first) if
[pat_first_, pat_last_) is empty,
otherwise returns
make_pair(last, last) if no such iterator is found
.Complexity:
At most
(last - first) * (pat_last_ - pat_first_) applications of the predicate
.