From Jason Turner

[logical.operations]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpvnhtpyl1/{from.md → to.md} +39 -6
tmp/tmpvnhtpyl1/{from.md → to.md} RENAMED
@@ -3,36 +3,69 @@
3
  The library provides basic function object classes for all of the
4
  logical operators in the language ([[expr.log.and]], [[expr.log.or]],
5
  [[expr.unary.op]]).
6
 
7
  ``` cpp
8
- template <class T> struct logical_and {
9
- bool operator()(const T& x, const T& y) const;
10
  typedef T first_argument_type;
11
  typedef T second_argument_type;
12
  typedef bool result_type;
13
  };
14
  ```
15
 
16
  `operator()` returns `x && y`.
17
 
18
  ``` cpp
19
- template <class T> struct logical_or {
20
- bool operator()(const T& x, const T& y) const;
21
  typedef T first_argument_type;
22
  typedef T second_argument_type;
23
  typedef bool result_type;
24
  };
25
  ```
26
 
27
  `operator()` returns `x || y`.
28
 
29
  ``` cpp
30
- template <class T> struct logical_not {
31
- bool operator()(const T& x) const;
32
  typedef T argument_type;
33
  typedef bool result_type;
34
  };
35
  ```
36
 
37
  `operator()` returns `!x`.
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  The library provides basic function object classes for all of the
4
  logical operators in the language ([[expr.log.and]], [[expr.log.or]],
5
  [[expr.unary.op]]).
6
 
7
  ``` cpp
8
+ template <class T = void> struct logical_and {
9
+ constexpr bool operator()(const T& x, const T& y) const;
10
  typedef T first_argument_type;
11
  typedef T second_argument_type;
12
  typedef bool result_type;
13
  };
14
  ```
15
 
16
  `operator()` returns `x && y`.
17
 
18
  ``` cpp
19
+ template <class T = void> struct logical_or {
20
+ constexpr bool operator()(const T& x, const T& y) const;
21
  typedef T first_argument_type;
22
  typedef T second_argument_type;
23
  typedef bool result_type;
24
  };
25
  ```
26
 
27
  `operator()` returns `x || y`.
28
 
29
  ``` cpp
30
+ template <class T = void> struct logical_not {
31
+ constexpr bool operator()(const T& x) const;
32
  typedef T argument_type;
33
  typedef bool result_type;
34
  };
35
  ```
36
 
37
  `operator()` returns `!x`.
38
 
39
+ ``` cpp
40
+ template <> struct logical_and<void> {
41
+ template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
42
+ -> decltype(std::forward<T>(t) && std::forward<U>(u));
43
+
44
+ typedef unspecified is_transparent;
45
+ };
46
+ ```
47
+
48
+ `operator()` returns `std::forward<T>(t) && std::forward<U>(u)`.
49
+
50
+ ``` cpp
51
+ template <> struct logical_or<void> {
52
+ template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
53
+ -> decltype(std::forward<T>(t) || std::forward<U>(u));
54
+
55
+ typedef unspecified is_transparent;
56
+ };
57
+ ```
58
+
59
+ `operator()` returns `std::forward<T>(t) || std::forward<U>(u)`.
60
+
61
+ ``` cpp
62
+ template <> struct logical_not<void> {
63
+ template <class T> constexpr auto operator()(T&& t) const
64
+ -> decltype(!std::forward<T>(t));
65
+
66
+ typedef unspecified is_transparent;
67
+ };
68
+ ```
69
+
70
+ `operator()` returns `!std::forward<T>(t)`.
71
+