ZeroErr
载入中...
搜索中...
未找到
zeroerr::ElementOf< T > 模板类 参考

ElementOf is a domain that generates random values from a fixed set of elements 更多...

#include <element_of.h>

类 zeroerr::ElementOf< T > 继承关系图:
zeroerr::ElementOf< T > 的协作图:

Public 类型

using ValueType = T
 
using CorpusType = uint64_t
 

Public 成员函数

 ElementOf (std::vector< T > elements)
 
CorpusType GetRandomCorpus (Rng &rng) override
 
ValueType GetValue (const CorpusType &v) const override
 
CorpusType FromValue (const ValueType &v) const override
 
void Mutate (Rng &rng, CorpusType &v, bool only_shrink) const override
 
- Public 成员函数 继承自 zeroerr::Domain< T, uint64_t >
virtual ~Domain ()=default
 
virtual uint64_t GetRandomCorpus (Rng &rng) const=0
 
virtual T GetRandomValue (Rng &rng) const
 
virtual uint64_t ParseCorpus (IRObject v) const
 
virtual IRObject SerializeCorpus (const uint64_t &v) const
 

Public 属性

std::vector< T > elements
 

详细描述

template<typename T>
class zeroerr::ElementOf< T >

ElementOf is a domain that generates random values from a fixed set of elements

模板参数
TThe type of elements to generate

This domain allows generating random values by selecting from a predefined set of elements. The elements are provided as a vector during construction.

Example:

// Generate random values from a set of strings
auto domain = ElementOf<std::string>({"red", "green", "blue"});
// Generate random values from a set of integers
auto domain = ElementOf<int>({1, 2, 3, 4, 5});
ElementOf is a domain that generates random values from a fixed set of elements
Definition element_of.h:28

成员类型定义说明

◆ CorpusType

template<typename T >
using zeroerr::ElementOf< T >::CorpusType = uint64_t

◆ ValueType

template<typename T >
using zeroerr::ElementOf< T >::ValueType = T

构造及析构函数说明

◆ ElementOf()

template<typename T >
zeroerr::ElementOf< T >::ElementOf ( std::vector< T >  elements)
inline

成员函数说明

◆ FromValue()

template<typename T >
CorpusType zeroerr::ElementOf< T >::FromValue ( const ValueType v) const
inlineoverridevirtual

◆ GetRandomCorpus()

template<typename T >
CorpusType zeroerr::ElementOf< T >::GetRandomCorpus ( Rng rng)
inlineoverride

◆ GetValue()

template<typename T >
ValueType zeroerr::ElementOf< T >::GetValue ( const CorpusType v) const
inlineoverridevirtual

◆ Mutate()

template<typename T >
void zeroerr::ElementOf< T >::Mutate ( Rng rng,
CorpusType v,
bool  only_shrink 
) const
inlineoverridevirtual

类成员变量说明

◆ elements

template<typename T >
std::vector<T> zeroerr::ElementOf< T >::elements

该类的文档由以下文件生成: