C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Add std::shift_left and std::shift_right as function objects

From: Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
Date: Fri, 28 Jul 2023 00:36:38 -0400
On Thu, Jul 27, 2023 at 11:16 PM Leon Lenk via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> [...] we were surprised to find that there is no functional object for
> left and right bit shifts in <functional>, even though every other binary
> operator in C++ has a corresponding functional object!
>

Not *every* operator. Notably missing is "comma". The (unary) operator I
miss the most — that I've had several opportunities to use in real code —
would be `std::star`.
Anyway, someone else has beaten you
<https://en.cppreference.com/w/cpp/algorithm/shift> to grab those names!
P0769 <https://www.open-std.org/JTC1/SC22/wg21/docs/papers/2018/p0769r2.pdf>
doesn't seem to have considered the possible objection "What if we later
want the name `std::shift_left` for <functional>?" But maybe the author
(Dan Raviv) knows whether that issue was ever discussed in LEWG, and if so,
what the counter-argument was.

HTH,
Arthur

Received on 2023-07-28 04:36:51