Date: Wed, 13 Sep 2023 10:27:09 -0500
On Wed, Sep 13, 2023, 10:20 AM Grzegorz Sikorski via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> Hello,
>
> I am new to the std-proposals and I assume something like this has already
> been considered in the past, but I wonder if it was rejected for any reason
> or is it planned to address at some point?
>
> I started to notice a pattern that appears in many places. Consider a code
> like this:
>
> struct Button {
> std::string name;
> bool enabled;
> };
>
> auto get_enabled(const auto& buttons) {
> return std::ranges::views::filter([](const auto& button) { return
> button.enabled; });
> }
>
> What I find useful is to add something like
> https://godbolt.org/z/7Y5bdeddd. Projection support could also be useful
> in some other std::ranges::views namespace members.
>
> Greg
>
Are you just looking for views::filter(&Button::enabled)? That already
works.
Barry
>
std-proposals_at_[hidden]> wrote:
> Hello,
>
> I am new to the std-proposals and I assume something like this has already
> been considered in the past, but I wonder if it was rejected for any reason
> or is it planned to address at some point?
>
> I started to notice a pattern that appears in many places. Consider a code
> like this:
>
> struct Button {
> std::string name;
> bool enabled;
> };
>
> auto get_enabled(const auto& buttons) {
> return std::ranges::views::filter([](const auto& button) { return
> button.enabled; });
> }
>
> What I find useful is to add something like
> https://godbolt.org/z/7Y5bdeddd. Projection support could also be useful
> in some other std::ranges::views namespace members.
>
> Greg
>
Are you just looking for views::filter(&Button::enabled)? That already
works.
Barry
>
Received on 2023-09-13 15:27:22