martinus / robin-hood-hashing

Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20
https://gitter.im/martinus/robin-hood-hashing
MIT License
1.5k stars 142 forks source link

Moving a local object in a return statement prevents copy elision #89

Closed ned14 closed 3 years ago

ned14 commented 3 years ago
../thirdparty/llfio/include/../../../src/core/../robin_hood.hpp:1259:33: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
 1259 |             return std::move(tmp);
      |                                 ^
../thirdparty/llfio/include/../../../src/core/../robin_hood.hpp:1259:33: note: remove ‘std::move’ call
martinus commented 3 years ago

what compiler are you using? I wonder why my g++10.1.0 doesn't detect this when I add that flag

martinus commented 3 years ago

Ah, it works because I didn't have a test for it :man_facepalming:

Thanks for finding, fixed in 8eb44ddef7118f1045781895108cdd4d6cbbd0e2