1.. _module-pw_containers-multiple_containers: 2 3------------------------------------ 4Using items with multiple containers 5------------------------------------ 6Several of Pigweed's containers feature instrusive items, where the data needed 7to track where an item is in a container is stored in the item itself. Intrusive 8items may be used with multiple containers, provided each of those containers is 9templated on a type that is not derived from any of the others. This can be 10achieved using multiple inheritance from distinct types: 11 12.. literalinclude:: examples/multiple_containers.cc 13 :language: cpp 14 :linenos: 15 :start-after: [pw_containers-multiple_containers] 16 :end-before: [pw_containers-multiple_containers] 17 18If one or more types is derived from another, the compiler will fail to build 19with an error that ``ItemType`` is ambiguous or found in multiple base classes. 20