brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 1722844 Raw
71 lines · c
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-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCPP___CXX03___FUNCTIONAL_BIND_H11#define _LIBCPP___CXX03___FUNCTIONAL_BIND_H12 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_header25#endif26 27_LIBCPP_BEGIN_NAMESPACE_STD28 29template <class _Tp>30struct is_bind_expression31    : _If< _IsSame<_Tp, __remove_cvref_t<_Tp> >::value, false_type, is_bind_expression<__remove_cvref_t<_Tp> > > {};32 33template <class _Tp>34struct is_placeholder35    : _If< _IsSame<_Tp, __remove_cvref_t<_Tp> >::value,36           integral_constant<int, 0>,37           is_placeholder<__remove_cvref_t<_Tp> > > {};38 39namespace placeholders {40 41template <int _Np>42struct __ph {};43 44// C++17 recommends that we implement placeholders as `inline constexpr`, but allows45// implementing them as `extern <implementation-defined>`. Libc++ implements them as46// `extern const` in all standard modes to avoid an ABI break in C++03: making them47// `inline constexpr` requires removing their definition in the shared library to48// avoid ODR violations, which is an ABI break.49//50// In practice, since placeholders are empty, `extern const` is almost impossible51// 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 placeholders64 65template <int _Np>66struct is_placeholder<placeholders::__ph<_Np> > : public integral_constant<int, _Np> {};67 68_LIBCPP_END_NAMESPACE_STD69 70#endif // _LIBCPP___CXX03___FUNCTIONAL_BIND_H71