خرید بک لینک

Vote count: 0

I'm writing a custom OrderedTree class I want to use as a key to an unordered_set.

I want to do a couple things when hashing the Tree:

  1. calculate the hash lazily and cache it as needed (since this may be an expensive operation),
  2. maybe balance the tree.

Neither of these operations change the semantic equality or hash value of the object, but they do modify some private fields.

Unfortunately, trying to modify any members in OrderedTree while inside std::hash<Tree>::operator() seems to violate const correctness that unordered_set expects.

Can I use my OrderedTree with unordered_set? If so, how?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 23 فروردين 1395 ساعت: 1:19

صفحه بندی