greg7mdp / parallel-hashmap

A family of header-only, very fast and memory-friendly hashmap and btree containers.
https://greg7mdp.github.io/parallel-hashmap/
Apache License 2.0
2.47k stars 234 forks source link

Add missing header for std::setw std::setprecision #241

Closed Earthwings closed 3 months ago

Earthwings commented 3 months ago

When running

cmake -DPHMAP_BUILD_TESTS=ON -DPHMAP_BUILD_EXAMPLES=ON .. && cmake --build

using

$ g++ --version
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

I'm getting

/workspace/src/parallel-hashmap/examples/llil4map.cc:78: warning: ignoring ‘#pragma clang diagnostic’ [-Wunknown-pragmas]
   78 |     #pragma clang diagnostic push
      | 
/workspace/src/parallel-hashmap/examples/llil4map.cc:79: warning: ignoring ‘#pragma clang diagnostic’ [-Wunknown-pragmas]
   79 |     #pragma clang diagnostic ignored "-Wunused-parameter"
      | 
/workspace/src/parallel-hashmap/examples/llil4map.cc:80: warning: ignoring ‘#pragma clang diagnostic’ [-Wunknown-pragmas]
   80 |     #pragma clang diagnostic ignored "-Wshadow"
      | 
/workspace/src/parallel-hashmap/examples/llil4map.cc:84: warning: ignoring ‘#pragma clang diagnostic’ [-Wunknown-pragmas]
   84 |     #pragma clang diagnostic pop
      | 
/workspace/src/parallel-hashmap/examples/llil4map.cc: In function ‘int main(int, char**)’:
/workspace/src/parallel-hashmap/examples/llil4map.cc:379:22: error: ‘setprecision’ is not a member of ‘std’
  379 |    std::cerr << std::setprecision(3) << std::setiosflags(std::ios::fixed);
      |                      ^~~~~~~~~~~~
/workspace/src/parallel-hashmap/examples/llil4map.cc:379:46: error: ‘setiosflags’ is not a member of ‘std’
  379 |    std::cerr << std::setprecision(3) << std::setiosflags(std::ios::fixed);
      |                                              ^~~~~~~~~~~
/workspace/src/parallel-hashmap/examples/llil4map.cc:427:51: error: ‘setw’ is not a member of ‘std’
  427 |       std::cerr << "get properties      " << std::setw(8) << ctaken1 << " secs\n";
      |                                                   ^~~~
/workspace/src/parallel-hashmap/examples/llil4map.cc: In lambda function:
/workspace/src/parallel-hashmap/examples/llil4map.cc:448:73: warning: declaration of ‘set’ shadows a previous local [-Wshadow]
  448 |             set.with_submap(i, [&](const string_cnt_set_t::EmbeddedSet& set) {
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/workspace/src/parallel-hashmap/examples/llil4map.cc:420:24: note: shadowed declaration is here
  420 |       string_cnt_set_t set;
      |                        ^~~
/workspace/src/parallel-hashmap/examples/llil4map.cc: In lambda function:
/workspace/src/parallel-hashmap/examples/llil4map.cc:456:69: warning: declaration of ‘set’ shadows a previous local [-Wshadow]
  456 |             set.with_submap_m(i, [&](string_cnt_set_t::EmbeddedSet& set) {
      |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/workspace/src/parallel-hashmap/examples/llil4map.cc:420:24: note: shadowed declaration is here
  420 |       string_cnt_set_t set;
      |                        ^~~
/workspace/src/parallel-hashmap/examples/llil4map.cc: In function ‘int main(int, char**)’:
/workspace/src/parallel-hashmap/examples/llil4map.cc:469:51: error: ‘setw’ is not a member of ‘std’
  469 |       std::cerr << "map to vector       " << std::setw(8) << ctaken2 << " secs\n";
      |                                                   ^~~~
/workspace/src/parallel-hashmap/examples/llil4map.cc:496:48: error: ‘setw’ is not a member of ‘std’
  496 |    std::cerr << "vector stable sort  " << std::setw(8) << ctaken3s << " secs\n";
      |                                                ^~~~
/workspace/src/parallel-hashmap/examples/llil4map.cc:497:48: error: ‘setw’ is not a member of ‘std’
  497 |    std::cerr << "write stdout        " << std::setw(8) << ctaken3o << " secs\n";
      |                                                ^~~~
/workspace/src/parallel-hashmap/examples/llil4map.cc:498:48: error: ‘setw’ is not a member of ‘std’
  498 |    std::cerr << "total time          " << std::setw(8) << ctaken   << " secs\n";
      |                                                ^~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-gnu-zero-variadic-macro-arguments’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
gmake[2]: *** [CMakeFiles/ex_llil4map.dir/build.make:76: CMakeFiles/ex_llil4map.dir/examples/llil4map.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1121: CMakeFiles/ex_llil4map.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
greg7mdp commented 3 months ago

Thank you for the fix @Earthwings .