Path: blob/main/contrib/llvm-project/libcxx/include/__cxx03/__functional/bind.h
213799 views
// -*- C++ -*-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-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___CXX03___FUNCTIONAL_BIND_H10#define _LIBCPP___CXX03___FUNCTIONAL_BIND_H1112#include <__cxx03/__config>13#include <__cxx03/__functional/weak_result_type.h>14#include <__cxx03/__fwd/functional.h>15#include <__cxx03/__type_traits/decay.h>16#include <__cxx03/__type_traits/invoke.h>17#include <__cxx03/__type_traits/is_reference_wrapper.h>18#include <__cxx03/__type_traits/is_void.h>19#include <__cxx03/__type_traits/remove_cvref.h>20#include <__cxx03/cstddef>2122#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)23# pragma GCC system_header24#endif2526_LIBCPP_BEGIN_NAMESPACE_STD2728template <class _Tp>29struct is_bind_expression30: _If< _IsSame<_Tp, __remove_cvref_t<_Tp> >::value, false_type, is_bind_expression<__remove_cvref_t<_Tp> > > {};3132template <class _Tp>33struct is_placeholder34: _If< _IsSame<_Tp, __remove_cvref_t<_Tp> >::value,35integral_constant<int, 0>,36is_placeholder<__remove_cvref_t<_Tp> > > {};3738namespace placeholders {3940template <int _Np>41struct __ph {};4243// C++17 recommends that we implement placeholders as `inline constexpr`, but allows44// implementing them as `extern <implementation-defined>`. Libc++ implements them as45// `extern const` in all standard modes to avoid an ABI break in C++03: making them46// `inline constexpr` requires removing their definition in the shared library to47// avoid ODR violations, which is an ABI break.48//49// In practice, since placeholders are empty, `extern const` is almost impossible50// to distinguish from `inline constexpr` from a usage stand point.51_LIBCPP_EXPORTED_FROM_ABI extern const __ph<1> _1;52_LIBCPP_EXPORTED_FROM_ABI extern const __ph<2> _2;53_LIBCPP_EXPORTED_FROM_ABI extern const __ph<3> _3;54_LIBCPP_EXPORTED_FROM_ABI extern const __ph<4> _4;55_LIBCPP_EXPORTED_FROM_ABI extern const __ph<5> _5;56_LIBCPP_EXPORTED_FROM_ABI extern const __ph<6> _6;57_LIBCPP_EXPORTED_FROM_ABI extern const __ph<7> _7;58_LIBCPP_EXPORTED_FROM_ABI extern const __ph<8> _8;59_LIBCPP_EXPORTED_FROM_ABI extern const __ph<9> _9;60_LIBCPP_EXPORTED_FROM_ABI extern const __ph<10> _10;6162} // namespace placeholders6364template <int _Np>65struct is_placeholder<placeholders::__ph<_Np> > : public integral_constant<int, _Np> {};6667_LIBCPP_END_NAMESPACE_STD6869#endif // _LIBCPP___CXX03___FUNCTIONAL_BIND_H707172