From Jason Turner

[depr.negators]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpnyflvjg2/{from.md → to.md} +70 -0
tmp/tmpnyflvjg2/{from.md → to.md} RENAMED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Negators <a id="depr.negators">[[depr.negators]]</a>
2
+
3
+ The header `<functional>` has the following additions:
4
+
5
+ ``` cpp
6
+ namespace std {
7
+ template <class Predicate> class unary_negate;
8
+ template <class Predicate>
9
+ constexpr unary_negate<Predicate> not1(const Predicate&);
10
+ template <class Predicate> class binary_negate;
11
+ template <class Predicate>
12
+ constexpr binary_negate<Predicate> not2(const Predicate&);
13
+ }
14
+ ```
15
+
16
+ Negators `not1` and `not2` take a unary and a binary predicate,
17
+ respectively, and return their logical negations ([[expr.unary.op]]).
18
+
19
+ ``` cpp
20
+ template <class Predicate>
21
+ class unary_negate {
22
+ public:
23
+ constexpr explicit unary_negate(const Predicate& pred);
24
+ constexpr bool operator()(const typename Predicate::argument_type& x) const;
25
+ using argument_type = typename Predicate::argument_type;
26
+ using result_type = bool;
27
+ };
28
+ ```
29
+
30
+ ``` cpp
31
+ constexpr bool operator()(const typename Predicate::argument_type& x) const;
32
+ ```
33
+
34
+ *Returns:* `!pred(x)`.
35
+
36
+ ``` cpp
37
+ template <class Predicate>
38
+ constexpr unary_negate<Predicate> not1(const Predicate& pred);
39
+ ```
40
+
41
+ *Returns:* `unary_negate<Predicate>(pred)`.
42
+
43
+ ``` cpp
44
+ template <class Predicate>
45
+ class binary_negate {
46
+ public:
47
+ constexpr explicit binary_negate(const Predicate& pred);
48
+ constexpr bool operator()(const typename Predicate::first_argument_type& x,
49
+ const typename Predicate::second_argument_type& y) const;
50
+ using first_argument_type = typename Predicate::first_argument_type;
51
+ using second_argument_type = typename Predicate::second_argument_type;
52
+ using result_type = bool;
53
+
54
+ };
55
+ ```
56
+
57
+ ``` cpp
58
+ constexpr bool operator()(const typename Predicate::first_argument_type& x,
59
+ const typename Predicate::second_argument_type& y) const;
60
+ ```
61
+
62
+ *Returns:* `!pred(x,y)`.
63
+
64
+ ``` cpp
65
+ template <class Predicate>
66
+ constexpr binary_negate<Predicate> not2(const Predicate& pred);
67
+ ```
68
+
69
+ *Returns:* `binary_negate<Predicate>(pred)`.
70
+