C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Proposal for std::(set / map / multiset / multimap)::partition_point

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Tue, 11 Jun 2024 20:21:48 -0400
On Tue, Jun 11, 2024 at 6:15 PM Aeren via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>>
>> Yes, this is one of the possible approaches. The other, which is probably what most competitive programmers would do, is just use twice as much memory by maintaining a parallel second `std::set` that's sorted on y instead of x. That way, you can just do lower_bound on the first set to answer queries of type Q2, and lower_bound on the second set to answer queries of type Q3.
>
>
> If we also require that the element found in Q2 and Q3 must be deleted, this approach doesn't work anymore.
>
>> I think we need motivation outside of competitive programming in order to generate interest in standardization. I don't even mention competitive programming to WG21 because I know they'll just laugh at me.
>
>
> This is my first time proposing and I don't know how things get decided on WG21 so please correct me if I'm missing something, but this statement sounds weird to me for the following reasons
>
> 1. In my initial proposal, I stated that my motivation is adding a counterpart to std::partition_point to BBST structures, just like std::lower_bound and std::upper_bound, and this doesn't really sound "competitive-programming-motivated" to me. This is motivated by the "completeness" of the standard library more than anything.

But that's not your "motivation"; that's your *proposal*. You're just
describing what you want changed.

Good motivation is all about arguing that there is a problem,
outlining the shape of that problem, and explaining why that problem
needs a solution. Of particular value is being able to show that
programmers frequently encounter this problem and that it inhibits
their work in some way.

> 2. The example I gave applies to any setting that can be abstracted into that form, and it looked general enough that whenever you're dealing with optimization over multivariate functions, I thought that this proposal can be very useful. I'm not sure how adding "competitive programming" changes anything. Would it be better if I instead wrote "I found this abstractization in my production code"?

Did you?

Changes to the standard should be motivated by a desire to help
working programmers do their jobs better. They shouldn't be motivated
by people playing around with the language. People can do that, but
the language shouldn't change just to help them. As such, citing
"competitive programming" examples is not a *convincing* way to get
other people to think that this is a problem that needs solving.

So if you really did find this to be useful in production code, then
that would be more convincing of a motivation than citing competitive
programming challenges.

Received on 2024-06-12 00:22:01