lundi 17 août 2020

How to use a bsoncxx::types::b_oid as the key of a std::map

I'm using bsoncxx to manage data in a MongoDB database. Consider this declaration in a custom class:

std::map<bsoncxx::types::b_oid, SomeClassHere> m_Documents;

The compiler complains: "error C2676: binary '<': 'const _Ty' does not define this operator or a conversion to a type acceptable to the predefined operator"

Surprisingly, operator< is declared in oid.hpp:

friend BSONCXX_API bool BSONCXX_CALL operator<(const oid& lhs, const oid& rhs);

So, whats wrong in my code?

Thanks in advance for any hint.

Aucun commentaire:

Enregistrer un commentaire