[cfe-dev] How does Clang implement unordered_sets?

Mehdi Amini via cfe-dev cfe-dev at lists.llvm.org
Fri Jan 8 14:59:50 PST 2016


> On Jan 8, 2016, at 12:59 PM, Montana Burr via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> Hi,
> 
>     I'm new to C++, and I've been doing some research on unordered_sets. As I understand, an unordered_set is a hash table that contains a key that is also its value.

I’m not sure what you mean, is is a hash_table that contains value. The key is the hash of the value.

See: __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique() for instance, here: https://llvm.org/svn/llvm-project/libcxx/trunk/include/__hash_table


> What I'd like to know is how Clang figures out where objects in unordered_sets go.

clang is just a C++ compiler. The STL container are implemented by the standard library, and clang can work with libstdc++ or libc++ (the link I posted above is the latter).

— 
Mehdi




More information about the cfe-dev mailing list