From Jason Turner

[bitwise.operations]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp9a2y1b5j/{from.md → to.md} +61 -7
tmp/tmp9a2y1b5j/{from.md → to.md} RENAMED
@@ -1,39 +1,93 @@
1
  ### Bitwise operations <a id="bitwise.operations">[[bitwise.operations]]</a>
2
 
3
  The library provides basic function object classes for all of the
4
  bitwise operators in the language ([[expr.bit.and]], [[expr.or]],
5
- [[expr.xor]]).
6
 
7
  ``` cpp
8
- template <class T> struct bit_and {
9
- T operator()(const T& x, const T& y) const;
10
  typedef T first_argument_type;
11
  typedef T second_argument_type;
12
  typedef T result_type;
13
  };
14
  ```
15
 
16
  `operator()` returns `x & y`.
17
 
18
  ``` cpp
19
- template <class T> struct bit_or {
20
- T operator()(const T& x, const T& y) const;
21
  typedef T first_argument_type;
22
  typedef T second_argument_type;
23
  typedef T result_type;
24
  };
25
  ```
26
 
27
  `operator()` returns `x | y`.
28
 
29
  ``` cpp
30
- template <class T> struct bit_xor {
31
- T operator()(const T& x, const T& y) const;
32
  typedef T first_argument_type;
33
  typedef T second_argument_type;
34
  typedef T result_type;
35
  };
36
  ```
37
 
38
  `operator()` returns `x ^ y`.
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ### Bitwise operations <a id="bitwise.operations">[[bitwise.operations]]</a>
2
 
3
  The library provides basic function object classes for all of the
4
  bitwise operators in the language ([[expr.bit.and]], [[expr.or]],
5
+ [[expr.xor]], [[expr.unary.op]]).
6
 
7
  ``` cpp
8
+ template <class T = void> struct bit_and {
9
+ constexpr T operator()(const T& x, const T& y) const;
10
  typedef T first_argument_type;
11
  typedef T second_argument_type;
12
  typedef T result_type;
13
  };
14
  ```
15
 
16
  `operator()` returns `x & y`.
17
 
18
  ``` cpp
19
+ template <class T = void> struct bit_or {
20
+ constexpr T operator()(const T& x, const T& y) const;
21
  typedef T first_argument_type;
22
  typedef T second_argument_type;
23
  typedef T result_type;
24
  };
25
  ```
26
 
27
  `operator()` returns `x | y`.
28
 
29
  ``` cpp
30
+ template <class T = void> struct bit_xor {
31
+ constexpr T operator()(const T& x, const T& y) const;
32
  typedef T first_argument_type;
33
  typedef T second_argument_type;
34
  typedef T result_type;
35
  };
36
  ```
37
 
38
  `operator()` returns `x ^ y`.
39
 
40
+ ``` cpp
41
+ template <class T = void> struct bit_not {
42
+ constexpr T operator()(const T& x) const;
43
+ typedef T argument_type;
44
+ typedef T result_type;
45
+ };
46
+ ```
47
+
48
+ `operator()` returns `~x`.
49
+
50
+ ``` cpp
51
+ template <> struct bit_and<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 bit_or<void> {
63
+ template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
64
+ -> decltype(std::forward<T>(t) | std::forward<U>(u));
65
+
66
+ typedef unspecified is_transparent;
67
+ };
68
+ ```
69
+
70
+ `operator()` returns `std::forward<T>(t) | std::forward<U>(u)`.
71
+
72
+ ``` cpp
73
+ template <> struct bit_xor<void> {
74
+ template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
75
+ -> decltype(std::forward<T>(t) ^ std::forward<U>(u));
76
+
77
+ typedef unspecified is_transparent;
78
+ };
79
+ ```
80
+
81
+ `operator()` returns `std::forward<T>(t) ^ std::forward<U>(u)`.
82
+
83
+ ``` cpp
84
+ template <> struct bit_not<void> {
85
+ template <class T> constexpr auto operator()(T&& t) const
86
+ -> decltype(~std::forward<T>(t));
87
+
88
+ typedef unspecified is_transparent;
89
+ };
90
+ ```
91
+
92
+ `operator()` returns `~std::forward<T>(t)`.
93
+