[Cs3] const reference lambda and local bucket iterators in unordered containers
Mikhail Nesterenko
mnestere at kent.edu
Sun Oct 5 13:28:55 EDT 2025
> In class today you asked that I email you the two questions that I
> asked about C++ concepts beyond what the class covered. First you
> wanted me to ask you about what the intended usages for the
> beginning and end functions are for unordered containers,
So, the idea is that you, as a client, is able to check the efficient
of the hashing function. For example a bad hashing function may bunch
a lot of elements in a single bucket. Another benefit may be to
locally iterate over element of a bucket quickly and know when a,
potentially less efficient, jump to the next bucket may be.
Here is an discussion in stackoverflow that quotes C++11 standard
description on the issue.
https://stackoverflow.com/questions/31125360/what-is-the-use-for-buckets-interface-in-stdunordered-map
> and you
> also wanted me to ask about whether or not lambda's support the
> usage of const captures.
It is not possible in C++11 but possible in C++14
https://stackoverflow.com/questions/3772867/lambda-capture-as-const-reference
The technique const_cast will be covered later in the course.
Thank you,
--
Mikhail
More information about the cs3
mailing list