libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::LIBJMMCG_VER_NAMESPACE::unordered_tuple< KeyType, MappedType, Hasher, ExtractHash, MappedTypes > Class Template Referencefinal

A unordered container for a disparate list of types for which the keys form a perfect hash, computable at compile-time. More...

#include <unordered_tuple.hpp>

Inheritance diagram for jmmcg::LIBJMMCG_VER_NAMESPACE::unordered_tuple< KeyType, MappedType, Hasher, ExtractHash, MappedTypes >:
[legend]
Collaboration diagram for jmmcg::LIBJMMCG_VER_NAMESPACE::unordered_tuple< KeyType, MappedType, Hasher, ExtractHash, MappedTypes >:
[legend]

Public Types

enum  : std::size_t { size =sizeof...(MappedTypes) }
 
enum  : std::size_t { max_size =mapped_elem_stride*size }
 
using key_type = typename mapped_index_colln::key_type
 
using mapped_type = MappedType
 

Public Member Functions

 BOOST_MPL_ASSERT_RELATION (size, >, 0)
 
 unordered_tuple () noexcept(noexcept(default_ctors_t< MappedTypes... >::result(mapped_cont.data())))
 
template<class MappedCtorArg , class... MappedCtorArgs, class = typename std::enable_if<!std::is_convertible<MappedCtorArg, unordered_tuple>::value>::type>
 unordered_tuple (MappedCtorArg &&arg, MappedCtorArgs &&... args) noexcept(noexcept(ctors_t< MappedTypes... >::result(mapped_cont.data(), std::forward< MappedCtorArg >(arg), std::forward< MappedCtorArgs >(args)...)))
 
 ~unordered_tuple () noexcept(true)
 
constexpr mapped_type const & operator[] (const key_type key) const noexcept(true)
 Find the instance of mapped_type associated with the instance of key_type. More...
 
constexpr mapped_typeoperator[] (const key_type key) noexcept(true)
 Find the instance of mapped_type associated with the instance of key_type. More...
 

Detailed Description

template<class KeyType, class MappedType, class Hasher, template< class > class ExtractHash, class... MappedTypes>
class jmmcg::LIBJMMCG_VER_NAMESPACE::unordered_tuple< KeyType, MappedType, Hasher, ExtractHash, MappedTypes >

A unordered container for a disparate list of types for which the keys form a perfect hash, computable at compile-time.

This class performs zero memory allocations. All of the data is maintained on the stack at the cost of some additional space. There is padding added between each instance of a MappedType to ensure that those instances avoid false sharing in any cache level.

Definition at line 44 of file unordered_tuple.hpp.

Member Typedef Documentation

◆ key_type

template<class KeyType , class MappedType , class Hasher , template< class > class ExtractHash, class... MappedTypes>
using jmmcg::LIBJMMCG_VER_NAMESPACE::unordered_tuple< KeyType, MappedType, Hasher, ExtractHash, MappedTypes >::key_type = typename mapped_index_colln::key_type

Definition at line 153 of file unordered_tuple.hpp.

◆ mapped_type

template<class KeyType , class MappedType , class Hasher , template< class > class ExtractHash, class... MappedTypes>
using jmmcg::LIBJMMCG_VER_NAMESPACE::unordered_tuple< KeyType, MappedType, Hasher, ExtractHash, MappedTypes >::mapped_type = MappedType

Definition at line 154 of file unordered_tuple.hpp.

Member Enumeration Documentation

◆ anonymous enum

template<class KeyType , class MappedType , class Hasher , template< class > class ExtractHash, class... MappedTypes>
anonymous enum : std::size_t
Enumerator
size 

Definition at line 46 of file unordered_tuple.hpp.

◆ anonymous enum

template<class KeyType , class MappedType , class Hasher , template< class > class ExtractHash, class... MappedTypes>
anonymous enum : std::size_t
Enumerator
max_size 

Definition at line 63 of file unordered_tuple.hpp.

Constructor & Destructor Documentation

◆ unordered_tuple() [1/2]

template<class KeyType , class MappedType , class Hasher , template< class > class ExtractHash, class ... MappedTypes>
jmmcg::LIBJMMCG_VER_NAMESPACE::unordered_tuple< KeyType, MappedType, Hasher, ExtractHash, MappedTypes >::unordered_tuple
inlinenoexcept

Definition at line 23 of file unordered_tuple_impl.hpp.

◆ unordered_tuple() [2/2]

template<class KeyType , class MappedType , class Hasher , template< class > class ExtractHash, class ... MappedTypes>
template<class MappedCtorArg , class... MappedCtorArgs, class >
jmmcg::LIBJMMCG_VER_NAMESPACE::unordered_tuple< KeyType, MappedType, Hasher, ExtractHash, MappedTypes >::unordered_tuple ( MappedCtorArg &&  arg,
MappedCtorArgs &&...  args 
)
inlinenoexcept

If the construction of any instance of a mapped_type fails, then any already constructed instance of a mapped_type will be correctly deleted, and that failing exception re-thrown. Each of the MappedTypes is either default constructed or constructed with exactly, successively, one of the {arg, args...} parameters passed to this ctor. Thus there must be the same number of MappedTypes as the number of ctor arguments passed in. i.e. sizeof...(MappedTypes)==sizeof...(args)+1.

Definition at line 39 of file unordered_tuple_impl.hpp.

◆ ~unordered_tuple()

template<class KeyType , class MappedType , class Hasher , template< class > class ExtractHash, class ... MappedTypes>
jmmcg::LIBJMMCG_VER_NAMESPACE::unordered_tuple< KeyType, MappedType, Hasher, ExtractHash, MappedTypes >::~unordered_tuple
inlinenoexcept

Definition at line 55 of file unordered_tuple_impl.hpp.

Member Function Documentation

◆ BOOST_MPL_ASSERT_RELATION()

template<class KeyType , class MappedType , class Hasher , template< class > class ExtractHash, class... MappedTypes>
jmmcg::LIBJMMCG_VER_NAMESPACE::unordered_tuple< KeyType, MappedType, Hasher, ExtractHash, MappedTypes >::BOOST_MPL_ASSERT_RELATION ( size  ,
 
)

◆ operator[]() [1/2]

template<class KeyType , class MappedType , class Hasher , template< class > class ExtractHash, class ... MappedTypes>
constexpr unordered_tuple< KeyType, MappedType, Hasher, ExtractHash, MappedTypes... >::mapped_type const & jmmcg::LIBJMMCG_VER_NAMESPACE::unordered_tuple< KeyType, MappedType, Hasher, ExtractHash, MappedTypes >::operator[] ( const key_type  key) const
inlineconstexprnoexcept

Find the instance of mapped_type associated with the instance of key_type.

Algorithmic complexity: O(1) Note that great effort has been made to ensure that this is as fast as possible.

Parameters
keyThe instance of key_type associated with a mapped_type.
Returns
A reference to the associated instance of mapped_type.

Definition at line 61 of file unordered_tuple_impl.hpp.

◆ operator[]() [2/2]

template<class KeyType , class MappedType , class Hasher , template< class > class ExtractHash, class ... MappedTypes>
constexpr unordered_tuple< KeyType, MappedType, Hasher, ExtractHash, MappedTypes... >::mapped_type & jmmcg::LIBJMMCG_VER_NAMESPACE::unordered_tuple< KeyType, MappedType, Hasher, ExtractHash, MappedTypes >::operator[] ( const key_type  key)
inlineconstexprnoexcept

Find the instance of mapped_type associated with the instance of key_type.

Algorithmic complexity: O(1) Note that great effort has been made to ensure that this is as fast as possible.

Parameters
keyThe instance of key_type associated with a mapped_type.
Returns
A reference to the associated instance of mapped_type.

Definition at line 69 of file unordered_tuple_impl.hpp.


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