blob: 4075355174d99f35da03ba682a22d9b04beda658 [file] [log] [blame]
// -*- C++ -*-
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include <__config>
#pragma GCC system_header
#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 { };
constexpr explicit __function_like(__tag) noexcept {}
~__function_like() = default;
} // namespace ranges
#endif // !defined(_LIBCPP_HAS_NO_RANGES)