aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/__algorithm/specialized_algorithms.h
blob: a2ffd36f0c87d5d16b031929ad05e864aa141f8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP___ALGORITHM_SPECIALIZED_ALGORITHMS_H
#define _LIBCPP___ALGORITHM_SPECIALIZED_ALGORITHMS_H

#include <__config>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#  pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

namespace _Algorithm {
struct __fill_n {};
} // namespace _Algorithm

template <class>
struct __single_iterator;

// This struct allows specializing algorithms for specific arguments. This is useful when we know a more efficient
// algorithm implementation for e.g. library-defined iterators. _Alg is one of tags defined inside the _Algorithm
// namespace above. _Ranges is an essentially arbitrary subset of the arguments to the algorithm that are used for
// dispatching. This set is specific to the algorithm: look at each algorithm to see which arguments they use for
// dispatching to specialized algorithms.
//
// A specialization of `__specialized_algorithm` has to define `__has_algorithm` to true for the specialized algorithm
// to be used. This is intended for cases where iterators can do generic unwrapping and forward to a different
// specialization of `__specialized_algorithm`.
//
// If __has_algorithm is true, there has to be an operator() which will get called with the actual arguments to the
// algorithm.
template <class _Alg, class... _Ranges>
struct __specialized_algorithm {
  static const bool __has_algorithm = false;
};

_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP___ALGORITHM_SPECIALIZED_ALGORITHMS_H