Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/libcxx/include/__cxx03/__functional/bind.h
213799 views
1
// -*- C++ -*-
2
//===----------------------------------------------------------------------===//
3
//
4
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
// See https://llvm.org/LICENSE.txt for license information.
6
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
//
8
//===----------------------------------------------------------------------===//
9
10
#ifndef _LIBCPP___CXX03___FUNCTIONAL_BIND_H
11
#define _LIBCPP___CXX03___FUNCTIONAL_BIND_H
12
13
#include <__cxx03/__config>
14
#include <__cxx03/__functional/weak_result_type.h>
15
#include <__cxx03/__fwd/functional.h>
16
#include <__cxx03/__type_traits/decay.h>
17
#include <__cxx03/__type_traits/invoke.h>
18
#include <__cxx03/__type_traits/is_reference_wrapper.h>
19
#include <__cxx03/__type_traits/is_void.h>
20
#include <__cxx03/__type_traits/remove_cvref.h>
21
#include <__cxx03/cstddef>
22
23
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
24
# pragma GCC system_header
25
#endif
26
27
_LIBCPP_BEGIN_NAMESPACE_STD
28
29
template <class _Tp>
30
struct is_bind_expression
31
: _If< _IsSame<_Tp, __remove_cvref_t<_Tp> >::value, false_type, is_bind_expression<__remove_cvref_t<_Tp> > > {};
32
33
template <class _Tp>
34
struct is_placeholder
35
: _If< _IsSame<_Tp, __remove_cvref_t<_Tp> >::value,
36
integral_constant<int, 0>,
37
is_placeholder<__remove_cvref_t<_Tp> > > {};
38
39
namespace placeholders {
40
41
template <int _Np>
42
struct __ph {};
43
44
// C++17 recommends that we implement placeholders as `inline constexpr`, but allows
45
// implementing them as `extern <implementation-defined>`. Libc++ implements them as
46
// `extern const` in all standard modes to avoid an ABI break in C++03: making them
47
// `inline constexpr` requires removing their definition in the shared library to
48
// avoid ODR violations, which is an ABI break.
49
//
50
// In practice, since placeholders are empty, `extern const` is almost impossible
51
// to distinguish from `inline constexpr` from a usage stand point.
52
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<1> _1;
53
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<2> _2;
54
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<3> _3;
55
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<4> _4;
56
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<5> _5;
57
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<6> _6;
58
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<7> _7;
59
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<8> _8;
60
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<9> _9;
61
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<10> _10;
62
63
} // namespace placeholders
64
65
template <int _Np>
66
struct is_placeholder<placeholders::__ph<_Np> > : public integral_constant<int, _Np> {};
67
68
_LIBCPP_END_NAMESPACE_STD
69
70
#endif // _LIBCPP___CXX03___FUNCTIONAL_BIND_H
71
72