PLSSVM - Parallel Least Squares Support Vector Machine  2.0.0
A Least Squares Support Vector Machine implementation using different backends.
Public Types | Public Member Functions | Private Attributes | List of all members
plssvm::default_value< T > Class Template Reference

This class encapsulates a value that may be a default value or not. More...

#include <default_value.hpp>

Collaboration diagram for plssvm::default_value< T >:
[legend]

Public Types

using value_type = T
 The type encapsulated by this default_value.
 

Public Member Functions

constexpr default_value (default_init< value_type > default_val=default_init< value_type >{}) noexcept(std::is_nothrow_move_constructible_v< value_type >)
 Copy construct a default_value object using the provided default value. More...
 
constexpr default_valueoperator= (value_type non_default_val) noexcept(std::is_nothrow_move_assignable_v< value_type >)
 Override the previously provided default value with the new, non-default value. More...
 
template<typename U , PLSSVM_REQUIRES(std::is_convertible_v< U, value_type >) >
constexpr default_value (const default_value< U > &other) noexcept(std::is_nothrow_copy_constructible_v< U >)
 Copy-construct a new default_value from a possibly other type. More...
 
template<typename U , PLSSVM_REQUIRES(std::is_convertible_v< U, value_type >) >
constexpr default_value (default_value< U > &&other) noexcept(std::is_nothrow_move_constructible_v< U >)
 Move-construct a new default_value_from a possibly other type. More...
 
template<typename U , PLSSVM_REQUIRES(std::is_convertible_v< U, value_type >) >
constexpr default_valueoperator= (const default_value< U > &other) noexcept(std::is_nothrow_copy_assignable_v< U >)
 Copy-assign a new default_value from a possible other type. More...
 
template<typename U , PLSSVM_REQUIRES(std::is_convertible_v< U, value_type >) >
constexpr default_valueoperator= (default_value< U > &&other) noexcept(std::is_nothrow_move_assignable_v< U >)
 Move-assign a new default_value from a possible other type. More...
 
constexpr const value_typevalue () const noexcept
 Get the currently active value: the user provided value if provided, otherwise the default value is returned. More...
 
constexpr operator const value_type & () const noexcept
 Get the currently active value: the user provided value if provided, otherwise the default value is returned. More...
 
constexpr const value_typeget_default () const noexcept
 Get the default value even if it has already been overwritten by the user. More...
 
constexpr bool is_default () const noexcept
 Check whether the currently active value is the default value. More...
 
constexpr void swap (default_value &other) noexcept(std::is_nothrow_swappable_v< T >)
 Swap the content of two default_values. More...
 
constexpr void reset () noexcept
 Set the current active value back to the default value.
 

Private Attributes

value_type value_ {}
 The wrapped value to be used if use_default_init_ is false.
 
bool use_default_init_ { true }
 Flag used to determine whether the default value should be used or the user defined value.
 
default_init< value_typedefault_init_ {}
 The wrapped default value used if use_default_init_ is true.
 

Detailed Description

template<typename T>
class plssvm::default_value< T >

This class encapsulates a value that may be a default value or not.

Template Parameters
Tthe type of the encapsulated value

Constructor & Destructor Documentation

◆ default_value() [1/3]

template<typename T >
constexpr plssvm::default_value< T >::default_value ( default_init< value_type default_val = default_init<value_type>{})
inlineexplicitconstexprnoexcept

Copy construct a default_value object using the provided default value.

Afterward, is_default() will return true!

Parameters
[in]default_valset the default value of this default_value wrapper

◆ default_value() [2/3]

template<typename T >
template<typename U , PLSSVM_REQUIRES(std::is_convertible_v< U, value_type >) >
constexpr plssvm::default_value< T >::default_value ( const default_value< U > &  other)
inlineexplicitconstexprnoexcept

Copy-construct a new default_value from a possibly other type.

Template Parameters
Uthe type of the other default_value wrapper
Parameters
[in]otherthe other default_value potentially wrapping another type
Note
U must be convertible to value_type!

◆ default_value() [3/3]

template<typename T >
template<typename U , PLSSVM_REQUIRES(std::is_convertible_v< U, value_type >) >
constexpr plssvm::default_value< T >::default_value ( default_value< U > &&  other)
inlineexplicitconstexprnoexcept

Move-construct a new default_value_from a possibly other type.

Template Parameters
Uthe type of the other default_value wrapper
Parameters
[in,out]otherthe other default_value potentially wrapping another type
Note
U must be convertible to value_type!

Member Function Documentation

◆ operator=() [1/3]

template<typename T >
constexpr default_value& plssvm::default_value< T >::operator= ( value_type  non_default_val)
inlineconstexprnoexcept

Override the previously provided default value with the new, non-default value.

Afterward, is_default() will return false!

Parameters
[in]non_default_valthe non-default value
Returns
*this

◆ operator=() [2/3]

template<typename T >
template<typename U , PLSSVM_REQUIRES(std::is_convertible_v< U, value_type >) >
constexpr default_value& plssvm::default_value< T >::operator= ( const default_value< U > &  other)
inlineconstexprnoexcept

Copy-assign a new default_value from a possible other type.

Template Parameters
Uthe type of the other default_value wrapper
Parameters
otherthe other default_value potentially wrapping another type
Note
U must be convertible to value_type!
Returns
*this

◆ operator=() [3/3]

template<typename T >
template<typename U , PLSSVM_REQUIRES(std::is_convertible_v< U, value_type >) >
constexpr default_value& plssvm::default_value< T >::operator= ( default_value< U > &&  other)
inlineconstexprnoexcept

Move-assign a new default_value from a possible other type.

Template Parameters
Uthe type of the other default_value wrapper
Parameters
otherthe other default_value potentially wrapping another type
Note
U must be convertible to value_type!
Returns
*this

◆ value()

template<typename T >
constexpr const value_type& plssvm::default_value< T >::value ( ) const
inlineconstexprnoexcept

Get the currently active value: the user provided value if provided, otherwise the default value is returned.

Returns
the active value ([[nodiscard]])

◆ operator const value_type &()

template<typename T >
constexpr plssvm::default_value< T >::operator const value_type & ( ) const
inlineconstexprnoexcept

Get the currently active value: the user provided value if provided, otherwise the default value is returned.

Returns
the active value ([[nodiscard]])

◆ get_default()

template<typename T >
constexpr const value_type& plssvm::default_value< T >::get_default ( ) const
inlineconstexprnoexcept

Get the default value even if it has already been overwritten by the user.

Returns
the active value ([[nodiscard]])

◆ is_default()

template<typename T >
constexpr bool plssvm::default_value< T >::is_default ( ) const
inlineconstexprnoexcept

Check whether the currently active value is the default value.

Returns
true if the default value is currently active, false otherwise ([[nodiscard]])

◆ swap()

template<typename T >
constexpr void plssvm::default_value< T >::swap ( default_value< T > &  other)
inlineconstexprnoexcept

Swap the content of two default_values.

Parameters
[in,out]otherthe other default_value

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