OSVR-Core
Protected Types | Protected Member Functions | List of all members
osvr::util::UniqueContainerBase< Container, Policy, WrapperArgs > Class Template Reference

A policy-based generic "Unique Container", that wraps ContainerWrapper (and thus an underlying container) with set-like semantics/invariant: at most one instance of a value is in the container at a time. More...

#include <UniqueContainer.h>

Inheritance diagram for osvr::util::UniqueContainerBase< Container, Policy, WrapperArgs >:

Protected Types

using value_type = typename Container::value_type
 
using reference = typename Container::reference
 
using rv_reference = typename Container::value_type &&
 
using const_reference = typename Container::const_reference
 

Protected Member Functions

bool contains (const_reference v)
 Returns true iff the underlying container contains an instance of the given value. More...
 
bool insert (const_reference v)
 
bool insert (rv_reference v)
 
bool remove (const_reference v)
 
Container const & container () const
 Const access to the container is permitted.
 

Detailed Description

template<typename Container, typename Policy = unique_container_policies::PushBack, typename... WrapperArgs>
class osvr::util::UniqueContainerBase< Container, Policy, WrapperArgs >

A policy-based generic "Unique Container", that wraps ContainerWrapper (and thus an underlying container) with set-like semantics/invariant: at most one instance of a value is in the container at a time.

Intended as a base class, provides all its functionality in protected members.

Template Parameters
Containerunderlying container (such as std::vector<value_type>)
Policya type from osvr::util::unique_container_policies, defaulting to osvr::util::unique_container_policies::PushBack, that affects container interaction and performance, and may add additional invariants (such as ordering).
WrapperArgsoptional arguments to forward to osvr::util::ContainerWrapper

Blocks direct non-const access to the underlying container to maintain the class invariants.

For all methods, time complexity depends on the policy selected.

See also
osvr::util::unique_container_policies, osvr::util::ContainerWrapper, osvr::util::container_policies

Member Function Documentation

§ contains()

template<typename Container, typename Policy = unique_container_policies::PushBack, typename... WrapperArgs>
bool osvr::util::UniqueContainerBase< Container, Policy, WrapperArgs >::contains ( const_reference  v)
inlineprotected

Returns true iff the underlying container contains an instance of the given value.


The documentation for this class was generated from the following file: