C++ Client-Side SDK
LaunchDarkly SDK
Public Member Functions | List of all members
launchdarkly::EvaluationDetail< T > Class Template Reference

#include <evaluation_detail.hpp>

Public Member Functions

 EvaluationDetail (T value, std::optional< std::size_t > variation_index, std::optional< EvaluationReason > reason)
 
 EvaluationDetail (enum EvaluationReason::ErrorKind error_kind, T default_value)
 
 EvaluationDetail (EvaluationReason reason)
 
T const & Value () const
 
std::optional< std::size_t > VariationIndex () const
 
bool IsError () const
 
std::optional< EvaluationReason > const & Reason () const
 
T const & operator* () const
 

Detailed Description

template<typename T>
class launchdarkly::EvaluationDetail< T >

EvaluationDetail contains additional metadata related to a feature flag evaluation. To obtain an instance of EvaluationDetail, use a variation method suffixed with Detail, such as BoolVariationDetail.

Template Parameters
TThe primitive variation value, which is limited to bool, int, double, std::string, and launchdarkly::Value.

Constructor & Destructor Documentation

◆ EvaluationDetail() [1/3]

template<typename T >
launchdarkly::EvaluationDetail< T >::EvaluationDetail ( value,
std::optional< std::size_t >  variation_index,
std::optional< EvaluationReason reason 
)

Constructs an EvaluationDetail from results of an evaluation.

Parameters
valueThe variation value.
variation_indexThe variation index.
reasonThe reason for the results.

◆ EvaluationDetail() [2/3]

template<typename T >
launchdarkly::EvaluationDetail< T >::EvaluationDetail ( enum EvaluationReason::ErrorKind  error_kind,
default_value 
)

Constructs an EvaluationDetail representing an error and a default value.

Parameters
error_kindKind of the error.
default_valueDefault value.

◆ EvaluationDetail() [3/3]

template<typename T >
launchdarkly::EvaluationDetail< T >::EvaluationDetail ( EvaluationReason  reason)

Constructs an EvaluationDetail consisting of a reason but no value. This is used when a flag has no appropriate fallback value.

Parameters
reasonThe reason.

Member Function Documentation

◆ IsError()

template<typename T >
bool launchdarkly::EvaluationDetail< T >::IsError
Returns
True if the evaluation resulted in an error.

◆ operator*()

template<typename T >
T const & launchdarkly::EvaluationDetail< T >::operator*
Returns
A reference to the variation value.

◆ Reason()

template<typename T >
std::optional< EvaluationReason > const & launchdarkly::EvaluationDetail< T >::Reason
Returns
A reference to the reason for the results.

◆ Value()

template<typename T >
T const & launchdarkly::EvaluationDetail< T >::Value
Returns
A reference to the variation value. For convenience, the * operator may also be used to obtain the value.

◆ VariationIndex()

template<typename T >
std::optional< std::size_t > launchdarkly::EvaluationDetail< T >::VariationIndex
Returns
A variation index, if this was a successful evaluation; otherwise, std::nullopt.

The documentation for this class was generated from the following files: