Traits of general utility. More...
Classes | |
struct | util::extract_to_tuple_type< SrcTuple, Extractor, TargetClass > |
Returns type TargetClass<U...> from a SrcTuple<T...> . More... | |
struct | util::index_of_extracted_type< Extractor, Target, Tuple > |
Returns the index of the element in Tuple with the specified type. More... | |
struct | util::has_extracted_type< Extractor, Target, Tuple > |
Trait holding whether an element in Tuple type contains Target . More... | |
struct | util::has_duplicate_extracted_types< Extractor, Tuple > |
Traits holding whether elements of Tuple have duplicate types. More... | |
struct | util::count_extracted_types< Extractor, Target, Tuple > |
Counts the elements of a tuple-like type containing a Target type. More... | |
Typedefs | |
template<typename SrcTuple , template< typename T, typename...> class Extractor, template< typename...> class TargetClass = std::tuple> | |
using | util::extract_to_tuple_type_t = typename extract_to_tuple_type< SrcTuple, Extractor, TargetClass >::type |
Direct access to the type in extract_to_tuple_type . More... | |
template<typename Tuple , template< typename...> class TargetClass = std::tuple> | |
using | util::to_tuple = extract_to_tuple_type< Tuple, self_type, TargetClass > |
template<typename Tuple , template< typename...> class TargetClass = std::tuple> | |
using | util::to_tuple_t = typename to_tuple< Tuple, TargetClass >::type |
Direct access to the type in to_tuple . More... | |
template<typename Target , typename Tuple > | |
using | util::index_of_type = index_of_extracted_type< self_type, Target, Tuple > |
template<template< typename T, typename...> class Extractor, typename Target , typename Tuple > | |
using | util::type_with_extracted_type = std::tuple_element< index_of_extracted_type_v< Extractor, Target, Tuple >, Tuple > |
Returns the element type in Tuple with the specified type. More... | |
template<template< typename T, typename...> class Extractor, typename Target , typename Tuple > | |
using | util::type_with_extracted_type_t = typename type_with_extracted_type< Extractor, Target, Tuple >::type |
Direct access to the value in type_with_extracted_type . More... | |
template<typename Target , typename Tuple > | |
using | util::has_type = has_extracted_type< self_type, Target, Tuple > |
template<typename Tuple > | |
using | util::has_duplicate_types = has_duplicate_extracted_types< self_type, Tuple > |
template<typename Target , typename Tuple > | |
using | util::count_types = count_extracted_types< self_type, Target, Tuple > |
Functions | |
template<template< typename T, typename...> class Extractor, typename Target , typename Tuple > | |
auto | util::getByExtractedType (Tuple const &data) -> decltype(auto) |
Returns the value of the element containing the specified type. More... | |
Variables | |
template<template< typename T, typename...> class Extractor, typename Target , typename Tuple > | |
constexpr std::size_t | util::index_of_extracted_type_v = index_of_extracted_type<Extractor, Target, Tuple>() |
Direct access to the value in index_of_extracted_type . More... | |
template<typename Target , typename Tuple > | |
constexpr std::size_t | util::index_of_type_v = index_of_type<Target, Tuple>() |
Direct access to the value in index_of_type . More... | |
template<template< typename T, typename...> class Extractor, typename Target , typename Tuple > | |
constexpr bool | util::has_extracted_type_v = has_extracted_type<Extractor, Target, Tuple>() |
Direct access to the value in has_extracted_type . More... | |
template<typename Target , typename Tuple > | |
constexpr bool | util::has_type_v = has_type<Target, Tuple>() |
Direct access to the value in has_type . More... | |
template<template< typename T, typename...> class Extractor, typename Tuple > | |
constexpr bool | util::has_duplicate_extracted_types_v = has_duplicate_extracted_types<Extractor, Tuple>() |
Direct access to the value in has_duplicate_extracted_types . More... | |
template<typename Tuple > | |
constexpr bool | util::has_duplicate_types_v = has_duplicate_types<Tuple>() |
Direct access to the value in has_duplicate_types . More... | |
template<template< typename T, typename...> class Extractor, typename Target , typename Tuple > | |
constexpr unsigned int | util::count_extracted_types_v = count_extracted_types<Extractor, Target, Tuple>() |
Direct access to the value in count_extracted_types . More... | |
template<typename Target , typename Tuple > | |
constexpr unsigned int | util::count_types_v = count_types<Target, Tuple>() |
Direct access to the value in count_extracted_types . More... | |
Traits of general utility.
These traits are used in the implementation of the tag-related traits, but they are general enough that are deemed worth being exposed.
using util::count_types = typedef count_extracted_types<self_type, Target, Tuple> |
Counts the number of Target
elements in the specified Tuple
.
Definition at line 540 of file TupleLookupByTag.h.
using util::extract_to_tuple_type_t = typedef typename extract_to_tuple_type<SrcTuple, Extractor, TargetClass>::type |
Direct access to the type in extract_to_tuple_type
.
Definition at line 205 of file TupleLookupByTag.h.
using util::has_duplicate_types = typedef has_duplicate_extracted_types<self_type, Tuple> |
Like has_duplicate_extracted_types
, but on the element types directly.
has_duplicate_extracted_types
, index_of_type
, count_types
, has_types
, has_duplicate_types_v
Definition at line 483 of file TupleLookupByTag.h.
using util::has_type = typedef has_extracted_type<self_type, Target, Tuple> |
Like has_extracted_type
, but querying the element types directly.
has_extracted_type
, index_of_type
, count_types
, has_type_v
Definition at line 392 of file TupleLookupByTag.h.
using util::index_of_type = typedef index_of_extracted_type<self_type, Target, Tuple> |
Like index_of_extracted_type
, but querying the element types directly.
Definition at line 271 of file TupleLookupByTag.h.
using util::to_tuple = typedef extract_to_tuple_type<Tuple, self_type, TargetClass> |
extract_to_tuple_type
with no T
-to-U
type transformation.
extract_to_tuple_type
, to_tuple_t
Definition at line 212 of file TupleLookupByTag.h.
using util::to_tuple_t = typedef typename to_tuple<Tuple, TargetClass>::type |
Direct access to the type in to_tuple
.
Definition at line 217 of file TupleLookupByTag.h.
using util::type_with_extracted_type = typedef std::tuple_element <index_of_extracted_type_v<Extractor, Target, Tuple>, Tuple> |
Returns the element type in Tuple
with the specified type.
Extractor | extract the candidate type from a Tuple element |
Target | the type being sought |
Tuple | tuple-like data structure containing types. |
type_with_extracted_type_t
, index_of_extracted_type
, has_extracted_type
, count_extracted_types
, has_type
,Given a tuple-like type Tuple
, this traits returns the one element type which "contains" the target type Target
. For example:
int_container_t
will be std::vector<int>
, as the type in tuple_t
with int
as value_type
.
If the target type is not present, or if it is present more than once, a compilation error will ensue.
Definition at line 315 of file TupleLookupByTag.h.
using util::type_with_extracted_type_t = typedef typename type_with_extracted_type<Extractor, Target, Tuple>::type |
Direct access to the value in type_with_extracted_type
.
Definition at line 324 of file TupleLookupByTag.h.
auto util::getByExtractedType | ( | Tuple const & | data | ) | -> decltype(auto) |
Returns the value of the element containing the specified type.
Extractor | trait extracting the target type from an element |
Target | the type sought |
Tuple | a tuple-like type to get values from |
data | the tuple to get data from |
Target
type The value of the selected element in data
is returned, as in std::get
. The value is taken from the element of data which contains the target type Target
. The target type is extracted from each element in turn, using the
Extractor` trait.
This function has the same limitations as util::index_of_extracted_type
.
In the example:
realData
will be a reference std::vector<float>&
to the element containing { 1.5, 2.5 }
. Also note that in this example requesting the data of value type int
will cause a compilation error since there is more than one element with that value type.
Definition at line 1260 of file TupleLookupByTag.h.
constexpr unsigned int util::count_extracted_types_v = count_extracted_types<Extractor, Target, Tuple>() |
Direct access to the value in count_extracted_types
.
Definition at line 533 of file TupleLookupByTag.h.
constexpr unsigned int util::count_types_v = count_types<Target, Tuple>() |
Direct access to the value in count_extracted_types
.
Definition at line 544 of file TupleLookupByTag.h.
constexpr bool util::has_duplicate_extracted_types_v = has_duplicate_extracted_types<Extractor, Tuple>() |
Direct access to the value in has_duplicate_extracted_types
.
Definition at line 476 of file TupleLookupByTag.h.
constexpr bool util::has_duplicate_types_v = has_duplicate_types<Tuple>() |
Direct access to the value in has_duplicate_types
.
Definition at line 487 of file TupleLookupByTag.h.
constexpr bool util::has_extracted_type_v = has_extracted_type<Extractor, Target, Tuple>() |
Direct access to the value in has_extracted_type
.
Definition at line 386 of file TupleLookupByTag.h.
constexpr bool util::has_type_v = has_type<Target, Tuple>() |
Direct access to the value in has_type
.
Definition at line 396 of file TupleLookupByTag.h.
constexpr std::size_t util::index_of_extracted_type_v = index_of_extracted_type<Extractor, Target, Tuple>() |
Direct access to the value in index_of_extracted_type
.
Definition at line 264 of file TupleLookupByTag.h.
constexpr std::size_t util::index_of_type_v = index_of_type<Target, Tuple>() |
Direct access to the value in index_of_type
.
Definition at line 276 of file TupleLookupByTag.h.