blob: 4075355174d99f35da03ba682a22d9b04beda658 (
plain) (
blame)
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
47
48
49
50
51
|
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// 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___ITERATOR_FUNCTION_LIKE_H
#define _LIBCPP___ITERATOR_FUNCTION_LIKE_H
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_HAS_NO_RANGES)
namespace ranges {
// Per [range.iter.ops.general] and [algorithms.requirements], functions in namespace std::ranges
// can't be found by ADL and inhibit ADL when found by unqualified lookup. The easiest way to
// facilitate this is to use function objects.
//
// Since these are still standard library functions, we use `__function_like` to eliminate most of
// the properties that function objects get by default (e.g. semiregularity, addressability), to
// limit the surface area of the unintended public interface, so as to curb the effect of Hyrum's
// law.
struct __function_like {
__function_like() = delete;
__function_like(__function_like const&) = delete;
__function_like& operator=(__function_like const&) = delete;
void operator&() const = delete;
struct __tag { };
protected:
constexpr explicit __function_like(__tag) noexcept {}
~__function_like() = default;
};
} // namespace ranges
#endif // !defined(_LIBCPP_HAS_NO_RANGES)
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___ITERATOR_FUNCTION_LIKE_H
|