AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
probfd::ItemProbabilityPair< T, PrType > Class Template Reference

#include "probfd/distribution.h"

Description

template<typename T, typename PrType = value_t>
class probfd::ItemProbabilityPair< T, PrType >

An item-probability pair.

Public Member Functions

 ItemProbabilityPair ()=default
 Pairs a default-constructed item with an indeterminate probability.
 
template<typename A , typename B >
requires (std::is_constructible_v<T, A> && std::is_constructible_v<PrType, B>)
 explicit (!std::is_convertible_v< T, A >||!std::is_convertible_v< PrType, B >) ItemProbabilityPair(A &&item
 Pairs a given item with a given probability.
 
template<typename... Args, typename... Args2>
 ItemProbabilityPair (std::piecewise_construct_t, std::tuple< Args... > t1, std::tuple< Args2... > t2)
 Pairs an item constructed from a tuple of constructor arguments with a given probability.
 

Public Attributes

item
 The item.
 
PrType probability
 The probability of the item.
 

Friends

auto operator<=> (const ItemProbabilityPair< T, PrType > &left, const ItemProbabilityPair< T, PrType > &right)=default
 Lexicographical comparison.
 

Constructor & Destructor Documentation

◆ ItemProbabilityPair() [1/2]

template<typename T , typename PrType = value_t>
probfd::ItemProbabilityPair< T, PrType >::ItemProbabilityPair ( )
default

Pairs a default-constructed item with an indeterminate probability.

◆ ItemProbabilityPair() [2/2]

template<typename T , typename PrType = value_t>
template<typename... Args, typename... Args2>
probfd::ItemProbabilityPair< T, PrType >::ItemProbabilityPair ( std::piecewise_construct_t ,
std::tuple< Args... > t1,
std::tuple< Args2... > t2 )
inline

Pairs an item constructed from a tuple of constructor arguments with a given probability.

Member Function Documentation

◆ explicit()

template<typename T , typename PrType = value_t>
template<typename A , typename B >
requires (std::is_constructible_v<T, A> && std::is_constructible_v<PrType, B>)
probfd::ItemProbabilityPair< T, PrType >::explicit ( !std::is_convertible_v< T, A >||!std::is_convertible_v< PrType, B > ) &&

Pairs a given item with a given probability.

Friends And Related Symbol Documentation

◆ operator<=>

template<typename T , typename PrType = value_t>
auto operator<=> ( const ItemProbabilityPair< T, PrType > & left,
const ItemProbabilityPair< T, PrType > & right )
friend

Lexicographical comparison.

Member Data Documentation

◆ item

template<typename T , typename PrType = value_t>
T probfd::ItemProbabilityPair< T, PrType >::item

The item.

◆ probability

template<typename T , typename PrType = value_t>
PrType probfd::ItemProbabilityPair< T, PrType >::probability

The probability of the item.