1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___ALGORITHM_SPECIALIZED_ALGORITHMS_H
10#define _LIBCPP___ALGORITHM_SPECIALIZED_ALGORITHMS_H
11
12#include <__config>
13
14#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
15# pragma GCC system_header
16#endif
17
18_LIBCPP_BEGIN_NAMESPACE_STD
19
20namespace _Algorithm {
21struct __copy {};
22struct __fill_n {};
23struct __for_each {};
24struct __swap_ranges {};
25} // namespace _Algorithm
26
27template <class>
28struct __single_iterator;
29
30template <class, class>
31struct __iterator_pair;
32
33template <class>
34struct __single_range;
35
36// This struct allows specializing algorithms for specific arguments. This is useful when we know a more efficient
37// algorithm implementation for e.g. library-defined iterators. _Alg is one of tags defined inside the _Algorithm
38// namespace above. _Ranges is an essentially arbitrary subset of the arguments to the algorithm that are used for
39// dispatching. This set is specific to the algorithm: look at each algorithm to see which arguments they use for
40// dispatching to specialized algorithms.
41//
42// A specialization of `__specialized_algorithm` has to define `__has_algorithm` to true for the specialized algorithm
43// to be used. This is intended for cases where iterators can do generic unwrapping and forward to a different
44// specialization of `__specialized_algorithm`.
45//
46// If __has_algorithm is true, there has to be an operator() which will get called with the actual arguments to the
47// algorithm.
48template <class _Alg, class... _Ranges>
49struct __specialized_algorithm {
50 static const bool __has_algorithm = false;
51};
52
53_LIBCPP_END_NAMESPACE_STD
54
55#endif // _LIBCPP___ALGORITHM_SPECIALIZED_ALGORITHMS_H
56