P4006R0 — Transparent Function Objects for Shift Operators
(5 items)
LEWG
This paper proposes adding std::bit_lshift<> and std::bit_rshift<> as transparent function objects in to complete the set of bitwise operator functors. These follow the same transparent pattern as existing functors such as bit_and<> and plus<>, forwarding directly to the built-in << and >> operators with identical semantics. The paper also documents why other C++ operators without existing transparent function objects should remain excluded.
- §9 Wording, [Note 1] — Note 1 claims the functors "forward directly to the built-in operators," but the design (§3.2) and the Effects clause (unqualified <>>) both allow resolution to user-defined overloads; the note contradicts the paper's own stated intent. [2] [1]
- §9 Wording, proposed [bitwise.operations.shift] — All four operator() specifications use "Effects: Equivalent to: return ...;" but every peer in [bitwise.operations] and [arithmetic.operations] uses a "Returns:" clause; the proposed wording is inconsistent with the section it would join. [1] [2]
- §9 Wording, proposed [bitwise.operations.shift] — Parameter names are lhs/rhs for both typed and void specializations; the established convention in [bitwise.operations] and [arithmetic.operations] is x/y for typed specializations and t/u for void specializations. [3]
- References / Informative References — P3793R1 is cited throughout §2.2, §8.1.1, and §8.1.2 but has no entry in the bibliography; only [N3421] and [P2964R1] appear. [4]
References — Anthropic Citations API
[1]
"(References section lists only N3421 and P2964R1)"
"(References section lists only N3421 and P2964R1)"
[2]
chars 11559–13428
"Wording Add to [version.syn]: ``` «+#define __cpp_lib_bitwise_shift_functors YYYYMML // also in+»
```
Add to [functional.syn] in :
```
namespace std {
//..."
"Wording Add to [version.syn]: ``` «+#define __cpp_lib_bitwise_shift_functors YYYYMML // also in
[2]
chars 11559–13428
"Wording Add to [version.syn]: ``` «+#define __cpp_lib_bitwise_shift_functors YYYYMML // also in+»
```
Add to [functional.syn] in :
```
namespace std {
//..."
"Wording Add to [version.syn]: ``` «+#define __cpp_lib_bitwise_shift_functors YYYYMML // also in
[3]
"constexpr T operator()(const T& lhs, const T& rhs) const; and constexpr auto operator()(T&& lhs, U&& rhs) const"
"constexpr T operator()(const T& lhs, const T& rhs) const; and constexpr auto operator()(T&& lhs, U&& rhs) const"
[4]
chars 11559–13428
"Wording Add to [version.syn]: ``` «+#define __cpp_lib_bitwise_shift_functors YYYYMML // also in+»
```
Add to [functional.syn] in :
```
namespace std {
//..."
"Wording Add to [version.syn]: ``` «+#define __cpp_lib_bitwise_shift_functors YYYYMML // also in
[4]
chars 11559–13428
"Wording Add to [version.syn]: ``` «+#define __cpp_lib_bitwise_shift_functors YYYYMML // also in+»
```
Add to [functional.syn] in :
```
namespace std {
//..."
"Wording Add to [version.syn]: ``` «+#define __cpp_lib_bitwise_shift_functors YYYYMML // also in
Summary: P4006R0 proposes adding std::bit_lshift and std::bit_rshift transparent function objects to , paralleling the existing bit_and, bit_or, bit_xor, and bit_not in [bitwise.operations]. The paper targets consistency with P3793R1 which adds similar functors for other missing operators.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.