Added comment
This commit is contained in:
parent
cde18342da
commit
5ce9f8c8de
1 changed files with 11 additions and 0 deletions
|
|
@ -278,6 +278,17 @@ namespace graphene { namespace chain {
|
|||
*/
|
||||
class account_member_index : public secondary_index
|
||||
{
|
||||
/* std::less::operator() is less efficient so using key_compare here.
|
||||
* Let assume that it has two keys key1 and key2 and we want to insert key3.
|
||||
* the insert function needs to first call std::less::operator() with key1 and key3.
|
||||
* Assume std::less::operator()(key1, key3) returns false.
|
||||
* It has to call std::less::operator() again with the keys switched,
|
||||
* std::less::operator()(key3, key1), to decide whether key1 is equal to key3 or
|
||||
* key3 is greater than key1. There are two calls to std::less::operator() to make
|
||||
* a decision if the first call returns false.
|
||||
* std::map::insert and std::set used key_compare,
|
||||
* there would be sufficient information to make the right decision using just one call.
|
||||
*/
|
||||
class key_compare {
|
||||
public:
|
||||
inline bool operator()( const public_key_type& a, const public_key_type& b )const
|
||||
|
|
|
|||
Loading…
Reference in a new issue