std:: unordered_setとstd:: unordered_mapのclearメソッドについて、その計算量は 「本関数呼び出し前のコンテナの要素数( [size](https://cpprefjp.github.io/reference/unordered_set/unordered_set/size.html)() )に比例」と記述されている https://cpprefjp.github.io/reference/unordered_set/unordered_set/clear.html https://cpprefjp.github.io/reference/unordered_map/unordered_map/clear.html しかし、多くの実装では、実際には本関数呼び出し前の( [bucket_count](https://cpprefjp.github.io/reference/unordered_map/unordered_map/bucket_count.html)() )に比例している gccの実装: https://github.com/gcc-mirror/gcc/blob/fd50d2a24adaff9a9ba749fd0a1eb5a5c5ee35a8/libstdc%2B%2B-v3/include/bits/hashtable.h#L2707-L2720 clang LLVMの実装: https://github.com/llvm/llvm-project/blob/ad060dfa4c910e8253ba328be947ef70f6597326/libcxx/include/__hash_table#L1338-L1348 このことから、サイトの記述を実態にあったものに変えるべきである
std:: unordered_setとstd:: unordered_mapのclearメソッドについて、その計算量は
「本関数呼び出し前のコンテナの要素数( size() )に比例」と記述されている
https://cpprefjp.github.io/reference/unordered_set/unordered_set/clear.html
https://cpprefjp.github.io/reference/unordered_map/unordered_map/clear.html
しかし、多くの実装では、実際には本関数呼び出し前の( bucket_count() )に比例している
gccの実装: https://github.com/gcc-mirror/gcc/blob/fd50d2a24adaff9a9ba749fd0a1eb5a5c5ee35a8/libstdc%2B%2B-v3/include/bits/hashtable.h#L2707-L2720
clang LLVMの実装: https://github.com/llvm/llvm-project/blob/ad060dfa4c910e8253ba328be947ef70f6597326/libcxx/include/__hash_table#L1338-L1348
このことから、サイトの記述を実態にあったものに変えるべきである