API Reference: hate
-
template<size_t
N
, classWordType
= unsigned long>
classhate
::
bitset
- #include <bitset.h>
Constant-size bitset.
The bitset is accessible as array of unsigned integer words with configurable word-size. Logical operations are implemented for smaller-equal sized right-hand side bitsets. All logical operations are constexpr evaluable. The interface of std::bitset is to be mimicked for equal-sized operations as well as conversion to std::string and unsigned integer.
- Template Parameters
N – Number of bits
WordType – Type of underlying word storage
Public Functions
-
constexpr
bitset
() Default construct bitset with all bits disabled.
-
template<size_t
M
, classOtherWordType
>
constexprbitset
(bitset<M, OtherWordType> const &other) Construct bitset from possibly differently sized bitset.
Not present bits in the other bitset will be set to false (M < N), bits not present in this instance are ignored (M > N).
- Template Parameters
M – Size of bitset to construct instance from
OtherWordType – Type of underlying array of other bitset
- Parameters
other – Bitset to construct instance from
-
template<size_t
M
>
constexprbitset
(std::array<word_type, M> const &value) Construct bitset from array of words.
- Parameters
value – Value to construct from
-
constexpr
bitset
(uintmax_t const &value) Construct bitset from an unsigned integer.
- Parameters
value – Value to construct from
-
constexpr bool
all
() const Check if all bits are set to true.
- Returns
Result of check
-
constexpr bool
any
() const Check if any bit is set to true.
- Returns
Result of check
-
constexpr bitset &
flip
(size_t index) Flip bit.
- Parameters
index – Index of bit to flip
- Returns
Instance with bit flipped.
-
constexpr bool
none
() const Check if no bit is set to true.
- Returns
Result of check
-
explicit constexpr
operator std::array<word_type, num_words> const&
() const Conversion operator to underlying array of words.
- Returns
Array of words
-
explicit
operator std::string
() const Conversion operator to string.
‘1’ represents a bit set to true, ‘0’ represents a bit set to false.
- Returns
Bitset value as string
-
template<typename
UIntegerType
, typename = std::enable_if_t<std::is_unsigned<UIntegerType>::value>>
explicit constexproperator UIntegerType
() const Conversion operator to unsigned integer.
If the bitset does not fit the integer, high bits are dropped.
- Returns
Bitset value as unsigned integer
-
constexpr bool
operator!=
(bitset const &other) const Inequality operator.
- Parameters
other – Bitset to compare to
- Returns
Result of comparison
-
template<size_t
M
>
constexpr bitsetoperator&
(bitset<M, word_type> const &other) const Perform & operation on bitset with smaller or equal sized other bitset.
- Template Parameters
M – Size of other bitset
- Parameters
other – Other bitset
- Returns
(instance & other)
-
template<size_t
M
>
constexpr bitset &operator&=
(bitset<M, word_type> const &other) Perform &= operation on bitset with smaller or equal sized other bitset.
- Template Parameters
M – Size of other bitset
- Parameters
other – Other bitset
- Returns
(instance &= other)
-
constexpr bitset
operator<<
(size_t shift) const Perform << operation on bitset.
- Parameters
shift – Number of bits to shift right
- Returns
(instance << shift)
-
constexpr bitset &
operator<<=
(size_t shift) Perform <<= operation on bitset.
- Parameters
shift – Number of bits to shift right
- Returns
(instance <<= shift)
-
template<size_t
M
, classOtherWordType
>
constexpr bitset &operator=
(bitset<M, OtherWordType> const &other) Assign bitset from possibly differently sized bitset.
Not present bits in the other bitset will be set to false (M < N), bits not present in this instance are ignored (M > N).
- Template Parameters
M – Size of bitset to assign to instance
OtherWordType – Type of underlying array of other bitset
- Parameters
other – Bitset to assign to instance
-
template<size_t
M
, classOtherWordType
>
constexpr bitset<N, WordType> &operator=
(bitset<M, OtherWordType> const &other)
-
constexpr bool
operator==
(bitset const &other) const Equality operator.
- Parameters
other – Bitset to compare to
- Returns
Result of comparison
-
constexpr bitset
operator>>
(size_t shift) const Perform >> operation on bitset.
- Parameters
shift – Number of bits to shift right
- Returns
(instance >> shift)
-
constexpr bitset &
operator>>=
(size_t shift) Perform >>= operation on bitset.
- Parameters
shift – Number of bits to shift right
- Returns
(instance >>= shift)
-
template<size_t
M
>
constexpr bitsetoperator^
(bitset<M, word_type> const &other) const Perform ^ operation on bitset with smaller or equal sized other bitset.
- Template Parameters
M – Size of other bitset
- Parameters
other – Other bitset
- Returns
(instance ^ other)
-
template<size_t
M
>
constexpr bitset &operator^=
(bitset<M, word_type> const &other) Perform ^= operation on bitset with smaller or equal sized other bitset.
- Template Parameters
M – Size of other bitset
- Parameters
other – Other bitset
- Returns
(instance ^= other)
-
template<size_t
M
>
constexpr bitsetoperator|
(bitset<M, word_type> const &other) const Perform | operation on bitset with smaller or equal sized other bitset.
- Template Parameters
M – Size of other bitset
- Parameters
other – Other bitset
- Returns
(instance | other)
-
template<size_t
M
>
constexpr bitset &operator|=
(bitset<M, word_type> const &other) Perform |= operation on bitset with smaller or equal sized other bitset.
- Template Parameters
M – Size of other bitset
- Parameters
other – Other bitset
- Returns
(instance |= other)
-
constexpr bitset
operator~
() const Create new instance with flipped bits.
- Returns
New instance with all bits flipped.
-
constexpr bitset &
reset
() Set all bits of bitset to false.
- Returns
Instance with all bits set to false.
-
constexpr bitset &
reset
(size_t index) Set bit of bitset to false.
- Parameters
index – Index of bit to set
- Returns
Instance with bit set to false.
-
constexpr bitset &
set
() Set all bits of bitset to true.
- Returns
Instance with all bits set to true.
-
constexpr bitset &
set
(size_t index, bool value = true) Set bit of bitset to boolean value.
- Parameters
index – Index of bit to set
value – Boolean value to set bit to
- Returns
Instance with bit set to value.
-
constexpr bitset &
shift_words_left
(size_t word_shift) Perform <<= operation on bitset for multiples of num_bits_per_word.
- Parameters
word_shift – Number of words to shift
- Returns
(instance <<= word_shift * num_bits_per_word)
-
constexpr bitset &
shift_words_right
(size_t word_shift) Perform >>= operation on bitset for multiples of num_bits_per_word.
- Parameters
word_shift – Number of words to shift
- Returns
(instance >>= word_shift * num_bits_per_word)
-
constexpr bool
test
(size_t index) const Get boolean value of bit.
- Parameters
index – Index of bit to get
- Returns
Boolean value of bit
-
constexpr std::array<word_type, num_words> const &
to_array
() const Get underlying array of words.
- Returns
Array of words
-
std::string
to_string
() const Convert bitset to string.
‘1’ represents a bit set to true, ‘0’ represents a bit set to false.
- Returns
Bitset value as string
-
constexpr uintmax_t
to_uintmax
() const Convert bitset to maximal size unsigned integer.
If the bitset does not fit the integer, high bits are dropped.
- Returns
Bitset value as maximal-sized unsigned integer
-
constexpr unsigned long long
to_ullong
() const Convert bitset to unsigned long long integer.
If the bitset does not fit the integer, high bits are dropped.
- Returns
Bitset value as unsigned long long integer
-
constexpr unsigned long
to_ulong
() const Convert bitset to unsigned long integer.
If the bitset does not fit the integer, high bits are dropped.
- Returns
Bitset value as unsigned long integer
Public Static Attributes
-
static constexpr size_t
num_words
= (N + num_bits_per_word - 1) / num_bits_per_word
Private Functions
-
constexpr void
sanitize
() Sanitize the highest word to the possibly not full number of bits.
All bits at positions >= size % num_bits_per_word in the highest word are set to zero.
Private Static Functions
Friends
- friend class bitset
-
template<typename
Ta
, typenameTb
>
structconcat
-
template<typename ...
Ta
, typename ...Tb
>
structhate::detail
::
concat
<type_list<Ta...>, type_list<Tb...>> - #include <type_list.h>
-
template<typename
Default
, typenameAlwaysVoid
, template<typename...> typenameOp
, typename ...Args
>
structhate::detail
::
detector
- #include <type_traits.h>
Helpers for is_detected, detected_t and detected_or (will be provided by TS2 in the future)
-
template<typename
Default
, template<typename...> typenameOp
, typename ...Args
>
structhate::detail
::
detector
<Default, std::void_t<Op<Args...>>, Op, Args...> - #include <type_traits.h>
-
template<typename ...
Ts
>
structis_in_type_list
: public std::false_type - #include <type_list.h>
-
template<typename
T
, typename ...Us
>
structhate::detail
::
is_in_type_list
<T, type_list<Us...>> - #include <type_list.h>
Check if type is in type_list.
Public Static Attributes
-
static constexpr bool
value
= detail::is_in_type_list<T, Us...>::value
-
static constexpr bool
-
template<typename
T
, typenameU
, typename ...Us
>
structhate::detail
::
is_in_type_list
<T, U, Us...> - #include <type_list.h>
-
template<typename ...
TLs
>
structmulti_concat
-
template<typename
FirstTL
, typename ...TLs
>
structhate::detail
::
multi_concat
<FirstTL, TLs...> - #include <type_list.h>
-
template<typename
LastTL
>
structhate::detail
::
multi_concat
<LastTL> - #include <type_list.h>
-
template<typename
One
, typenameTwo
>
structhate::detail
::
multi_concat
<One, Two> - #include <type_list.h>
-
template<typename
T
>
structhate::detail
::
remove_all_qualifiers
- #include <type_traits.h>
-
template<typename
T
>
structhate::detail
::
remove_all_qualifiers
<T&> - #include <type_traits.h>
-
template<typename
T
>
structhate::detail
::
remove_all_qualifiers
<T&&> - #include <type_traits.h>
-
template<typename
T
>
structhate::detail
::
remove_all_qualifiers
<T*> - #include <type_traits.h>
-
template<typename
T
>
structhate::detail
::
remove_all_qualifiers
<T const> - #include <type_traits.h>
-
template<typename
T
>
structhate::detail
::
remove_all_qualifiers
<T volatile const> - #include <type_traits.h>
-
template<typename
T
>
structhate::detail
::
remove_all_qualifiers
<T volatile> - #include <type_traits.h>
-
template<typename
T
>
structto_false_type
: public std::false_type - #include <type_list.h>
-
template<typename
T
, typename ...Ts
>
structhate::detail
::
type_list_make_unique
- #include <type_list.h>
-
template<typename
T
>
structhate::detail
::
type_list_make_unique
<T> - #include <type_list.h>
-
template<typename
T
>
structhate
::
Empty
- #include <empty.h>
Empty structure wrapping type.
- Template Parameters
T – Type to wrap
Public Functions
-
inline
Empty
()
-
template<template<typename> typename
Filter
, typenameTL
>
structfilter_type_list
Apply given filter to type_list.
-
template<template<typename> typename
Filter
, typenameT
, typename ...Ts
>
structhate
::
filter_type_list
<Filter, hate::type_list<T, Ts...>> - #include <type_list.h>
-
template<template<typename> typename
Filter
>
structhate
::
filter_type_list
<Filter, hate::type_list<>> - #include <type_list.h>
-
template<typename
T
>
classhate
::
has_iterator
- #include <iterator_traits.h>
Implementation of a trait checking for “T::iterator”.
Public Types
-
std::integral_constant< bool, sizeof(test< T >(0))==sizeof(yes)> value_type
Public Static Attributes
-
static const bool
value
= sizeof(test<T>(0)) == sizeof(yes)
Private Types
-
typedef char
yes
-
-
struct
hate::has_iterator
::
no
Public Members
-
char
array
[2]
-
char
-
struct
hate
::
Indentation
- #include <indent.h>
Add indentation to multi-line string.
The indentation is added after every line break.
Public Functions
-
Indentation
() = default
Friends
-
friend std::ostream &
operator<<
(std::ostream &os, Indentation const &value) __attribute__((visibility("default")))
-
-
struct
hate
::
IndentingOstream
: private std::streambuf, public std::ostream - #include <indent.h>
Ostream wrapper which allows additing indentation on every line-break.
Protected Functions
-
virtual int
overflow
(int c) override
Friends
-
friend std::ostream &
operator<<
(std::ostream &os, Indentation const &value) __attribute__((visibility("default")))
-
virtual int
-
template<size_t
I
, typenameTL
>
structindex_type_list_by_integer
- #include <type_list.h>
Calculate the type of an index in a type_list.
Note
Bounds checking is performed.
- Returns
The type of a 0-based index.
-
template<size_t
I
, typename ...Ts
>
structhate
::
index_type_list_by_integer
<I, type_list<Ts...>> - #include <type_list.h>
-
template<typename
T
, typenameTL
>
structindex_type_list_by_type
- #include <type_list.h>
Calculate the index of a type in a type_list.
Note
Duplicates and non-existing type yield static_asserts.
- Returns
The 0-based index of the type.
-
template<typename
T
, typename ...Ts
>
structhate
::
index_type_list_by_type
<T, type_list<T, Ts...>> - #include <type_list.h>
Public Static Attributes
-
static constexpr size_t
value
= 0
-
static constexpr size_t
-
template<typename
T
, typenameU
, typename ...Ts
>
structhate
::
index_type_list_by_type
<T, type_list<U, Ts...>> - #include <type_list.h>
-
template<typename
T
, typename = void>
structis_container
: public std::false_type - #include <type_traits.h>
Check if a type adheres to the Container concept.
- Template Parameters
T – Type to check
-
template<typename
T
>
structis_container
<T, std::void_t<typename T::value_type, typename T::size_type, typename T::allocator_type, typename T::iterator, typename T::const_iterator, decltype(std::declval<T>().size()), decltype(std::declval<T>().begin()), decltype(std::declval<T>().end()), decltype(std::declval<T>().cbegin()), decltype(std::declval<T>().cend())>> : public std::true_type - #include <type_traits.h>
-
template<typename
T
, template<typename...> classU
>
structis_specialization_of
: public std::false_type - #include <iterator_traits.h>
Check if some type is a specialization of another type.
Note
This won’t work correctly with non-type parameters :(.
-
template<template<typename...> class
U
, typename ...Args
>
structis_specialization_of
<U<Args...>, U> : public std::true_type - #include <iterator_traits.h>
-
template<typename
T
>
structis_type_list
: public std::false_type - #include <type_list.h>
The corresponding type_list trait.
-
template<typename ...
Ts
>
structis_type_list
<type_list<Ts...>> : public std::true_type - #include <type_list.h>
-
template<typename
IteratorT
, typenameDelimiterT
>
structhate
::
Join
- #include <join.h>
Object which is serializable into an ostream by joining an iterator range of entries with delimiter in-between.
- Template Parameters
IteratorT – Type of begin/end iterators
DelimiterT – Type of delimiter
- Parameters
begin – Iterator pointing to begin
end – Iterator pointing to end
delimiter – Delimiter to insert between iterable elements
-
template<typename
IteratorT
, typenameDelimiterT
, typenameFunctorT
>
structhate
::
JoinTransformed
- #include <join.h>
Object which is serializable into an ostream by joining an iterator range of entries with delimiter in-between.
A transformation is applied to each entry prior to serialization.
- Template Parameters
IteratorT – Type of begin/end iterators
DelimiterT – Type of delimiter
FunctorT – Type of transformation, is required to be callable with *IteratorT as argument type
- Parameters
begin – Iterator pointing to begin
end – Iterator pointing to end
delimiter – Delimiter to insert between iterable elements
functor – Transformation to apply to each element of iterator range
-
struct
hate
::
MultidimIterator
- #include <multidim_iterator.h>
Public Functions
-
inline MultidimIterator
end
() const
-
inline bool
operator!=
(MultidimIterator const &other) const
-
inline MultidimIterator &
operator++
()
-
inline bool
operator==
(MultidimIterator const &other) const
-
inline MultidimIterator
-
struct
Nil
- #include <nil.h>
Empty structure to be used in APIs where a type is expected, but no reasonable implementation can be provided.
-
struct
hate
::
nonesuch
- #include <type_traits.h>
nonesuch cannot be constructed, destroyed, or copied.
(future TS2)
-
template<typename ...
Ts
>
classPasskey
Implementation of the passkey idiom that allows to give specific classes access to private members.
-
template<typename
T
, typename ...Ts
>
classhate
::
Passkey
<T, Ts...> : public hate::Passkey<Ts...> - #include <passkey.h>
Protected Attributes
-
friend T
-
-
template<typename
T
>
structhate
::
remove_all_qualifiers
- #include <type_traits.h>
Remove arbitrary combinations of pointer, reference and const/volatile qualifiers from a type.
- Template Parameters
T – Type to remove all qualifiers from
Public Types
-
typedef detail::remove_all_qualifiers<T>::type
type
-
template<typename
T
>
classhate
::
TrackModifications
- #include <track_modifications.h>
Simple wrapper that tracks whenever the wrapped object gets modified.
Because on a non-const object, the compiler will always choose the non-const version of a method, we cannot overload
operator*()
.Hence we use
operator*()
for read-only modified and request modification viaget()
.Public Functions
-
inline
TrackModifications
(TrackModifications &&other)
-
inline
TrackModifications
(TrackModifications const &other)
-
inline auto
elapsed
() const Get elapsed time since last modification.
-
inline std::add_lvalue_reference_t<value_type>
get
() Request to modify wrapped value.
-
template<typename
Duration
>
inline boolis_elapsed
(Duration const &duration) const Check if the given duration has elapsed.
-
inline std::add_lvalue_reference_t<value_type const>
operator*
() const Get read-only modified to wrapped value.
modified is not tracked.
-
inline TrackModifications &
operator=
(TrackModifications &&other)
-
inline TrackModifications &
operator=
(TrackModifications const &other)
Private Functions
-
inline void
modified
()
Private Members
-
value_type
m_wrapped
-
inline
-
template<typename ...
Ts
>
structtype_list
- #include <type_list.h>
type_list contains a variadic type list.
-
template<typename
FromT
>
structtype_list_from
- #include <type_list.h>
convert other types to typelist.
-
template<template<typename...> class
FromT
, typename ...Ts
>
structhate
::
type_list_from
<FromT<Ts...>> - #include <type_list.h>
-
template<typename
TL1
, typenameTL2
>
structhate
::
type_list_intersection
- #include <type_list.h>
Apply type intersection to type_list pair.
Public Types
-
template<typename
T
>
usingfilter
= is_in_type_list<T, TL2>
-
typedef filter_type_list_t<filter, TL1>
type
-
template<typename
-
template<typename
TL
>
structtype_list_size
- #include <type_list.h>
Calculate the size of a type_list.
Note
Duplicate types are counted.
- Returns
Number of entries in type_list.
-
template<typename ...
Ts
>
structhate
::
type_list_size
<type_list<Ts...>> - #include <type_list.h>
-
template<template<typename...> class, typename
TL
>
structtype_list_to
- #include <type_list.h>
convert type_list to any variadic data-type
-
template<template<typename...> class
TargetT
, typename ...Ts
>
structhate
::
type_list_to
<TargetT, type_list<Ts...>> - #include <type_list.h>
-
template<typename
TL
>
structtype_list_unique
Reduce type list to unique types.
- Parameters
TL – Type list to reduce
-
template<typename ...
Ts
>
structhate
::
type_list_unique
<hate::type_list<Ts...>> - #include <type_list.h>
Public Types
-
typedef detail::type_list_make_unique<Ts...>::type
type
-
typedef detail::type_list_make_unique<Ts...>::type
-
template<>
structhate
::
type_list_unique
<hate::type_list<>> - #include <type_list.h>
-
template<typename
T
>
structstd
::
remove_cvref
- #include <type_traits.h>
-
namespace
hate
Typedefs
-
template<typename
T
>
usingadd_empty_t
= typename detail::add_empty<T>::type Add an Empty wrapper to given type if not already an Empty wrapper is given.
- Template Parameters
T – Type to add Empty to
-
template<typename ...
Ts
>
usingconcat_t
= typename detail::concat<Ts...>::type Concatenation of the types of two type_list types into a new type_list (left to right).
-
template<class
Default
, template<class...> classOp
, class ...Args
>
usingdetected_or
= detail::detector<Default, void, Op, Args...>
-
template<class
Default
, template<class...> classOp
, class ...Args
>
usingdetected_or_t
= typename detected_or<Default, Op, Args...>::type
-
template<template<class...> class
Op
, class ...Args
>
usingdetected_t
= typename detail::detector<nonesuch, void, Op, Args...>::type
-
template<template<typename> typename
Filter
, typenameTL
>
usingfilter_type_list_t
= typename filter_type_list<Filter, TL>::type
-
template<template<class...> class
Op
, class ...Args
>
usingis_detected
= typename detail::detector<nonesuch, void, Op, Args...>::value_t detection types which will be provided by TS2
-
template<class
To
, template<class...> classOp
, class ...Args
>
usingis_detected_convertible
= std::is_convertible<detected_t<Op, Args...>, To>
-
template<class
Expected
, template<class...> classOp
, class ...Args
>
usingis_detected_exact
= std::is_same<Expected, detected_t<Op, Args...>>
-
template<typename ...
Ts
>
usingis_in_type_list
= detail::is_in_type_list<Ts...>
-
template<typename ...
Ts
>
usingmulti_concat_t
= typename detail::multi_concat<Ts...>::type
-
template<typename
T
>
usingremove_all_qualifiers_t
= typename remove_all_qualifiers<T>::type
-
template<typename
T
>
usingremove_empty_t
= typename detail::remove_empty<T>::type Remove Empty wrapper of given type if it is of form
Empty<U>
.- Template Parameters
T – Type to remove Empty from
-
template<typename ...
Ts
>
usingtype_list_from_t
= typename type_list_from<Ts...>::type
-
template<typename
TL1
, typenameTL2
>
usingtype_list_intersection_t
= typename type_list_intersection<TL1, TL2>::type
-
template<template<typename...> class
TargetT
, typenameTL
>
usingtype_list_to_t
= typename type_list_to<TargetT, TL>::type
-
template<typename
TL
>
usingtype_list_unique_t
= typename type_list_unique<TL>::type
Functions
-
template<typename
MapT
>
std::optional<std::reference_wrapper<typename MapT::mapped_type const>>cget
(MapT const &map, typename MapT::key_type const &key) Unified getter for unordered_map that returns an optional.
Constant variant.
- Parameters
map – Map from which to get value.
key – Key for value.
- Returns
Optional that contains const reference to value if contained in map, nullopt otherwise.
-
template<template<typename> typename
Optional
, typenameT1
, typenameT2
>
boolcompare_optional_equal
(Optional<T1> a, Optional<T2> b, bool const fall_back) Checks the equality of two variables of optional type.
If both variables hold values the function returns the boolean equality comparison of the two values. In case of at least one the values is absent the fall-back-value is returned.
- Parameters
a – First value to be compared.
b – Second value do be compared.
fall_back – Boolean value to be returned if a or b is uninitialized.
- Returns
Equality comparison of a and b if both hold values, fall-back-value otherwise.
-
template<class
T
>
constexpr Tfill_bits
(size_t max_index) Create bitmask with bits set to true up to (including) a specified index.
- Template Parameters
T – Type of bitmask
max_index – Index up to which to set bits to true
-
template<typename
F
, typenameHead
, typename ...Tuples
>
autofor_each
(F &&f, Head &&head, Tuples&&... tuples) Apply given function to arguments from tuples in order.
- Template Parameters
F – Function to for_each
Head – First tuple to get input from
Tuples – Other tuples to get input from
- Returns
Tuple of results of function invokation for all tuple elements
-
template<typename
T
>
std::stringfull_name
() Get fully qualified name of a type including namespaces.
The format follows “name::space::Type::SubType<TParams…>”.
- Template Parameters
T – Type to get name for
-
template<typename
MapT
>
std::optional<std::reference_wrapper<typename MapT::mapped_type>>get
(MapT &map, typename MapT::key_type const &key) Unified getter for unordered_map that returns an optional.
- Parameters
map – Map from which to get value.
key – Key for value.
- Returns
Optional that contains reference to value if contained in map, nullopt otherwise.
-
template<typename
IterableT
, typenameDelimiterT
>
autojoin
(IterableT &&iterable, DelimiterT &&delimiter) Create object which is serializable by joining an iterable with delimiter in-between.
- Template Parameters
IterableT – Type of iterable
DelimiterT – Type of delimiter
- Parameters
iterable – Iterable to join
delimiter – Delimiter to insert between iterable elements
-
template<typename
IterableT
, typenameDelimiterT
, typenameFunctorT
>
autojoin
(IterableT &&iterable, DelimiterT &&delimiter, FunctorT &&functor) Create object which is serializable by joining an iterable of entries with delimiter in-between and applying transformation prior to serialization.
- Template Parameters
IterableT – Type of iterable
DelimiterT – Type of delimiter
FunctorT – Type of transformationm, is required to be callable with any element of IterableT
- Parameters
iterable – Iterable to join
delimiter – Delimiter to insert between iterable elements
functor – Transformation to apply to each element of iterator range
-
template<typename
IteratorT
, typenameDelimiterT
>
Join<IteratorT, DelimiterT>join
(IteratorT &&begin, IteratorT &&end, DelimiterT &&delimiter) Create object which is serializable by joining an iterator range of entries with delimiter in-between.
- Template Parameters
IteratorT – Type of begin/end iterators
DelimiterT – Type of delimiter
- Parameters
begin – Iterator pointing to begin
end – Iterator pointing to end
delimiter – Delimiter to insert between iterable elements
-
template<typename
IteratorT
, typenameDelimiterT
, typenameFunctorT
>
JoinTransformed<IteratorT, DelimiterT, FunctorT>join
(IteratorT &&begin, IteratorT &&end, DelimiterT &&delimiter, FunctorT &&functor) Create object which is serializable by joining an iterator range of entries with delimiter in-between and applying transformation prior to serialization.
- Template Parameters
IteratorT – Type of begin/end iterators
DelimiterT – Type of delimiter
FunctorT – Type of transformation, is required to be callable with *IteratorT as argument type
- Parameters
begin – Iterator pointing to begin
end – Iterator pointing to end
delimiter – Delimiter to insert between iterable elements
functor – Transformation to apply to each element of iterator range
-
template<typename
IterableT
, typenameDelimiterT
>
std::stringjoin_string
(IterableT const &iterable, DelimiterT const &delimiter) Join iterable to string with delimiter in-between.
- Template Parameters
IterableT – Type of iterable
DelimiterT – Type of delimiter
- Parameters
iterable – Iterable instance to join
delimiter – Delimiter to use in-between
-
template<typename
IteratorT
, typenameDelimiterT
>
std::stringjoin_string
(IteratorT const &begin, IteratorT const &end, DelimiterT const &delimiter) Join iterable to string with delimiter in-between.
- Template Parameters
IteratorT – Iterator type
DelimiterT – Type of delimiter
- Parameters
begin – Iterator pointing to begin
end – Iterator pointing to end
delimiter – Delimiter to use in-between
-
template<typename
T
>
std::stringname
() Get name of a type stripped of namespaces and surrounding classes.
The format follows “SubType<TParams…>” for name::space::Type::SubType<Tparams…>.
- Template Parameters
T – Type to get name for
-
template<size_t
N
, classWordType
>
std::ostream &operator<<
(std::ostream &os, bitset<N, WordType> const &value)
-
template<typename
IteratorT
, typenameDelimiterT
>
std::ostream &operator<<
(std::ostream &os, Join<IteratorT, DelimiterT> const &value)
-
template<typename
IteratorT
, typenameDelimiterT
, typenameFunctorT
>
std::ostream &operator<<
(std::ostream &os, JoinTransformed<IteratorT, DelimiterT, FunctorT> const &value)
-
template<class ...
Ts
>overloaded
(Ts...) -> overloaded<Ts...>
-
template<int
Precision
= 3, typenameRep
, typenamePeriod
>
std::stringto_string
(std::chrono::duration<Rep, Period> const &value) Convert duration with specified minimal precision for nano-, micro-, milli- or seconds to string.
The correct metric prefix is chosen for the unit print. The precision states the minimal number of digits to be printed, only above 1000s the number of digits is increased. Not printed characters are discarded without looking at rounding.
- Template Parameters
precision – Number of digits to print (minimally, defaults to 3 to be aligned with metric prefix steps)
Rep – Representation type used in duration
Period – Period specifier of duration
- Parameters
value – Duration value to print
Variables
-
template<typename
T
>
static constexpr boolis_container_v
= is_container<T>::value
-
template<class
To
, template<class...> classOp
, class ...Args
>
constexpr boolis_detected_convertible_v
= is_detected_convertible<To, Op, Args...>::value
-
template<class
Expected
, template<class...> classOp
, class ...Args
>
constexpr boolis_detected_exact_v
= is_detected_exact<Expected, Op, Args...>::value
-
template<template<class...> class
Op
, class ...Args
>
constexpr boolis_detected_v
= is_detected<Op, Args...>::value
-
template<typename
-
namespace
hate
::
detail
Functions
-
template<size_t
Position
, typenameF
, typename ...Tuples
>
autofor_each
(F &&f, Tuples&&... tuples) Apply given function to arguments from tuples at given position.
- Template Parameters
Position – Position to get tuple elements from
F – Function to for_each
Tuples – Tuples to get elements from
- Returns
Result of function invokation
-
template<size_t
FirstPosition
, size_t...Positions
, typenameF
, typename ...Tuples
>
autofor_each
(std::integer_sequence<size_t, FirstPosition, Positions...> const&, F &&f, Tuples&&... tuples) Apply given function to arguments from tuples in order of positions given by sequence.
- Template Parameters
Positions – Positions to get tuple elements from
F – Function to for_each
Tuples – Tuples to get elements from
- Returns
Tuple of results of function invokation at given positions
-
template<typename
Head
, typename ...Tuples
>
constexpr boolhas_equal_tuple_size
() Get whether given tuples have equal size.
- Template Parameters
Head – First tuple
Tuples – Other tuples
- Returns
Boolean value
-
template<size_t
Size
, typenameHead
, typename ...Tuples
>
constexpr boolhas_tuple_size
() Get whether given tuples have given size.
- Template Parameters
Size – Size to check against
Head – First tuple
Tuples – Other tuples
- Returns
Boolean value
-
template<size_t
-
namespace
hate
::
math
Functions
-
constexpr size_t
log2
(size_t value) Calculate the logarithm to the power of two of an integer value.
- Parameters
value – Value to calculate log2 for
-
constexpr size_t
num_bits
(size_t n) Calculates the minimal number of bits needed to store the integer.
- Parameters
n – Integer number
- Returns
Result of calculation
-
constexpr size_t
pow
(size_t base, size_t exp) Calculate the power of an integer value.
- Parameters
base – Base value
exp – Exponent value
-
constexpr size_t
round_up_integer_division
(size_t number, size_t divisor) Calculates the integer division rounded up.
- Parameters
number – Number to calculate division for
divisor – Divisor
- Returns
Result of division
-
constexpr size_t
round_up_to_multiple
(size_t number, size_t multiple) Rounds up a number to full multiples.
- Parameters
number – Number to round up
multiple – Multiple to use as base for rounding
- Returns
Rounded number
-
constexpr size_t
-
namespace
std
STL namespace.
Typedefs
-
template<typename
T
>
usingremove_cvref_t
= typename remove_cvref<T>::type
-
template<typename
-
file
algorithm.h
- #include <>#include <>
-
file
bitset.h
- #include <>#include <>#include <>#include <>#include <>#include <>#include <>
-
file
empty.h
- #include <>
-
file
indent.h
- #include “hate/visibility.h”#include <>#include <>
-
file
iterator_traits.h
- #include <>
-
file
join.h
- #include <>#include <>#include <>#include <>
-
file
macros.h
-
file
math.h
- #include <>
-
file
memory.h
- #include <>#include <>#include <>
-
file
multidim_iterator.h
- #include <>#include <>
-
file
nil.h
-
file
optional.h
- #include <>
-
file
passkey.h
-
file
timer.h
- #include <>#include <>#include <>#include <>#include <>#include <>
-
file
track_modifications.h
- #include <>#include <>#include <>#include <>
-
file
tuple.h
- #include “hate/nil.h”#include <>#include <>#include <>#include <>#include <>
-
file
type_index.h
- #include <>
-
file
type_list.h
- #include <>#include <>
This header contains helper classes for handling C++ (variadic) type lists.
-
file
type_traits.h
- #include <>
-
file
unordered_map.h
- #include <>#include <>#include <>
-
file
variant.h
-
file
visibility.h
-
dir
/jenkins/jenlib_workspaces_f9/doc_gerrit_documentation-brainscales2-dependencies.ZG9jX2dlcnJpdF9kb2N1bWVudGF0aW9uLWJyYWluc2NhbGVzMi1kZXBlbmRlbmNpZXMjMTI4MDc.x/hate
-
dir
/jenkins/jenlib_workspaces_f9/doc_gerrit_documentation-brainscales2-dependencies.ZG9jX2dlcnJpdF9kb2N1bWVudGF0aW9uLWJyYWluc2NhbGVzMi1kZXBlbmRlbmNpZXMjMTI4MDc.x/hate/include/hate
-
dir
/jenkins/jenlib_workspaces_f9/doc_gerrit_documentation-brainscales2-dependencies.ZG9jX2dlcnJpdF9kb2N1bWVudGF0aW9uLWJyYWluc2NhbGVzMi1kZXBlbmRlbmNpZXMjMTI4MDc.x/hate/include