Code :
struct key_compare; struct key { bool top; int serial_num; friend struct key_compare; private: size_t get_hash() const { return (serial_num >> 1) + (top << 10); } }; struct key_compare { bool operator()(const key &lhs, const key &rhs) const { return lhs.get_hash() < rhs.get_hash(); } }; struct items { int a; int b; int c; std::string g; } std::map<key, items, key_compare> map_; int main() { map_.insert_or_assign({true, 1}, items()); map_.insert_or_assign({true, 2}, items()); }
Cpp check output:
foo.cpp:9:10: style: Unused private function: 'key::get_hash' [unusedPrivateFunction] size_t get_hash() const { return (serial_num >> 1) + (top << 10); }
cppcheck version : 2.4.1
Thanks! I can reproduce. I have created ticket https://trac.cppcheck.net/ticket/10265
Log in to post a comment.
Code :
Cpp check output:
cppcheck version : 2.4.1
Thanks! I can reproduce. I have created ticket https://trac.cppcheck.net/ticket/10265