• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef _LIBCPP___TYPE_TRAITS_OPERATION_TRAITS_H
10 #define _LIBCPP___TYPE_TRAITS_OPERATION_TRAITS_H
11 
12 #include <__config>
13 #include <__type_traits/integral_constant.h>
14 
15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16 #  pragma GCC system_header
17 #endif
18 
19 _LIBCPP_BEGIN_NAMESPACE_STD
20 
21 // Tags to represent the canonical operations
22 struct __equal_tag {};
23 struct __plus_tag {};
24 
25 // This class template is used to determine whether an operation "desugars"
26 // (or boils down) to a given canonical operation.
27 //
28 // For example, `std::equal_to<>`, our internal `std::__equal_to` helper and
29 // `ranges::equal_to` are all just fancy ways of representing a transparent
30 // equality operation, so they all desugar to `__equal_tag`.
31 //
32 // This is useful to optimize some functions in cases where we know e.g. the
33 // predicate being passed is actually going to call a builtin operator, or has
34 // some specific semantics.
35 template <class _CanonicalTag, class _Operation, class... _Args>
36 struct __desugars_to : false_type {};
37 
38 _LIBCPP_END_NAMESPACE_STD
39 
40 #endif // _LIBCPP___TYPE_TRAITS_OPERATION_TRAITS_H
41