/tac

type_aligned_container; a generic container adapter that stores unique types contiguously.

Primary LanguageC++MIT LicenseMIT

tac

type_aligned_container; a generic container adapter that stores unique types contiguously.

Example

If you would like to see compile-able examples, please see the examples directory.

type_aligned_container

This container requires you to have the types passed in as arguments to the type itself.

This container actually requires C++14, because of std::get<T>().

struct A {};
struct B {};
struct C {};

tac::type_aligned_container<A, B, C> container;
container.all<A>().emplace_back();
container.all<B>().emplace_back();
container.all<C>().emplace_back();

type_aligned_container_dyn

This container does not require you to have the types pass in as template arguments to the type itself. Instead, if you add a new type to the container, it will allocate (with new) a container to allocate the objects of the new type. This requires a check eveytime you add, and thus can be more expensive than the above container.

struct A {};
struct B {};
struct C {};

tac::type_aligned_container_dyn<> container;
container.all<A>().emplace_back();
container.all<B>().emplace_back();
container.all<C>().emplace_back();

License

See LICENSE.