8#if defined(ZEROERR_ENABLE_PFR) && (ZEROERR_CXX_STANDARD >= 14)
40template <
typename T,
typename... Inner>
44 using CorpusType = std::tuple<
typename Inner::CorpusType...>;
47 template <
unsigned... I>
52 template <
unsigned... I>
54 return ValueType{std::get<I>(inner_domains).GetValue(std::get<I>(v))...};
57 template <
unsigned... I>
59 return CorpusType{std::get<I>(inner_domains).FromValue(std::get<I>(v))...};
62 std::tuple<Inner...> inner_domains;
83 template <
typename D,
typename H>
90 unsigned index = rng.
bounded(
sizeof...(Inner));
97#ifdef ZEROERR_ENABLE_PFR
99template <
typename T,
typename... Inner>
100AggregateOfImpl<T, Inner...> StructOf(Inner&&... inner) {
101 return AggregateOfImpl<T, Inner...>(std::move(inner)...);
106template <
typename... Inner>
108 return AggregateOf<std::tuple<
typename Inner::ValueType...>, Inner...>(std::move(inner)...);
111template <
typename K,
typename V>
AggregateOf is a domain that combines multiple inner domains into a tuple or aggregate type.
Definition aggregate_of.h:41
void Mutate(Rng &rng, CorpusType &v, bool only_shrink) const override
Definition aggregate_of.h:89
T ValueType
Definition aggregate_of.h:43
CorpusType GetRandomCorpus(Rng &rng) const override
Definition aggregate_of.h:67
std::tuple< typename Inner::CorpusType... > CorpusType
Definition aggregate_of.h:44
CorpusType FromValue(const ValueType &v) const override
Definition aggregate_of.h:75
AggregateOf(Inner &&... inner)
Definition aggregate_of.h:65
ValueType GetValue(const CorpusType &v) const override
Definition aggregate_of.h:71
Domain class for generating random values of a specific type.
Definition domain.h:21
virtual CorpusType GetRandomCorpus(Rng &rng) const =0
uint32_t bounded(uint32_t range) noexcept
Definition rng.h:126
#define ZEROERR_SUPPRESS_COMMON_WARNINGS_POP
Definition config.h:265
#define ZEROERR_SUPPRESS_COMMON_WARNINGS_PUSH
Definition config.h:218
void visit2_at(const std::tuple< Ts... > &tup1, const std::tuple< T2s... > &tup2, size_t idx, F &&fun)
Definition typetraits.h:255
Definition benchmark.cpp:17
AggregateOf< std::tuple< typename Inner::ValueType... >, Inner... > TupleOf(Inner &&... inner)
Definition aggregate_of.h:107
AggregateOf< std::pair< typename K::ValueType, typename V::ValueType >, K, V > PairOf(K &&k, V &&v)
Definition aggregate_of.h:112
Definition aggregate_of.h:79
Rng & rng
Definition aggregate_of.h:80
bool only_shrink
Definition aggregate_of.h:81
void operator()(const D &domain, H &value)
Definition aggregate_of.h:84
Definition typetraits.h:77
Definition typetraits.h:74