uniform method naming convention for all lib std containers

Nick Treleaven nick at geany.org
Mon Jul 15 11:38:43 UTC 2024


On Sunday, 14 July 2024 at 18:02:57 UTC, mw wrote:
> I think for containers, it's better to have uniform method 
> naming convention, either contains, canFind or in, so writing 
> generic code (e.g. via D template) is easier.

`canFind` is O(n) in time (need to slice the RBT first to get a 
range).
`in` should be defined when the time complexity is better than 
O(log n).

See `in` under *Operations* here:
https://dlang.org/phobos/std_container.html


More information about the dip.ideas mailing list