Skip to content
Snippets Groups Projects
Commit 2432aa23 authored by Mark Schott's avatar Mark Schott Committed by CQ bot account: commit-bot@chromium.org
Browse files

[fbl] Make WAVLTreeConainable mulitply inheritable

Currently if you want to have your class able to live in multiple
WAVLTrees at once, you have to give it multiple WAVLTreeNodeState
members and define the node_state function in multiple NodeTraits
classes.

This change greatly simplifies this use case by allowing a
class to inherit multiple times from fbl::WAVLTreeContainable and pass
it a different tag type as the second template parameter each time. You
then pass the same tag type to the WAVLTree template and you're good to
go.

I also defined a helper template fbl::ContainableBaseClasses which allows
one to inherit from multiple Containable classes (even ones that aren't
necessarily WAVLTreeContainable) without also explicitly inheriting from
the fbl::HasTagTypes class, which is mostly an implementation detail.
This helper template also contains static_asserts to give understandable
error messages for common errors.

TEST: CQ, new stuff in intrusive_wavl_tree_test.cpp

Change-Id: Ib5d4d93b45152f8117ef2ad3fcdba6c70638bef9
parent a1312031
Loading
Showing
with 438 additions and 38 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment