ORIGINAL
Loading...
Searching...
No Matches
Public Member Functions | List of all members
original::alternative< void > Class Reference
Collaboration diagram for original::alternative< void >:
Collaboration graph

Public Member Functions

 alternative ()
 Constructs an empty alternative<void>
 
 alternative (null n)
 Constructs from null (empty state)
 
 alternative (std::in_place_t t)
 Constructs with value present.
 
void set () noexcept
 Sets the alternative to have a value.
 
alternativeoperator= (std::in_place_t t) noexcept
 Assignment from in_place tag to set as present.
 
alternativeoperator= (null n) noexcept
 Assignment from null to reset to empty state.
 
void reset () noexcept
 Resets to empty state.
 
bool hasValue () const
 Checks if contains a value.
 
 operator bool () const
 Boolean conversion operator.
 
 alternative (const alternative &other)=default
 Default copy constructor.
 
alternativeoperator= (const alternative &other)=default
 Default copy assignment.
 
 alternative (alternative &&other) noexcept
 Move constructor.
 
alternativeoperator= (alternative &&other) noexcept
 Move assignment.
 
void swap (alternative &other) noexcept
 Swaps contents with another alternative<void>
 
 ~alternative ()=default
 Default destructor.
 

Constructor & Destructor Documentation

◆ alternative() [1/3]

original::alternative< void >::alternative ( )
inlineexplicitdefault

Constructs an empty alternative<void>

Postcondition
hasValue() == false

◆ alternative() [2/3]

original::alternative< void >::alternative ( null  n)
inlineexplicit

Constructs from null (empty state)

Parameters
nnull value indicating empty state
Postcondition
hasValue() == false

◆ alternative() [3/3]

original::alternative< void >::alternative ( std::in_place_t  t)
inlineexplicit

Constructs with value present.

Parameters
tstd::in_place_t tag to indicate value should be present
Postcondition
hasValue() == true

Member Function Documentation

◆ hasValue()

bool original::alternative< void >::hasValue ( ) const
inline

Checks if contains a value.

Returns
true if contains value, false if empty

◆ operator bool()

original::alternative< void >::operator bool ( ) const
inlineexplicit

Boolean conversion operator.

Returns
true if contains value, false if empty

◆ operator=() [1/2]

original::alternative< void > & original::alternative< void >::operator= ( null  n)
inlinenoexcept

Assignment from null to reset to empty state.

Parameters
nnull value indicating empty state
Returns
Reference to this alternative
Postcondition
hasValue() == false

Resets the alternative<void> to the empty state. This operation is equivalent to calling reset() but provides a more expressive syntax when working with null values. The assignment clears the "present" state and ensures the alternative is empty.

Example usage:

alternative<void> flag(std::in_place); // Present state
flag = original::null; // Now empty
if (!flag) {
// This will execute since flag is now empty
}
// In generic code:
template<typename T>
opt = original::null; // Works for both alternative<T> and alternative<void>
}
A placeholder type representing the absence of a value.
Definition types.h:33
Unique ownership smart pointer with move semantics.
Definition ownerPtr.h:37
Note
This operation is noexcept and always succeeds.
See also
reset()

◆ operator=() [2/2]

original::alternative< void > & original::alternative< void >::operator= ( std::in_place_t  t)
inlinenoexcept

Assignment from in_place tag to set as present.

Parameters
tstd::in_place_t tag to indicate value should be present
Returns
Reference to this alternative
Postcondition
hasValue() == true

Sets the alternative<void> to the "present" state without storing any actual data. This is equivalent to calling set() but allows for more expressive syntax in template code.

Example usage:

flag = std::in_place; // Now has value present
// In template context:
template<typename T>
opt = std::in_place;
}
Note
This operation is noexcept and always succeeds.
See also
set()

◆ reset()

void original::alternative< void >::reset ( )
inlinenoexcept

Resets to empty state.

Postcondition
hasValue() == false

◆ set()

void original::alternative< void >::set ( )
inlinenoexcept

Sets the alternative to have a value.

Postcondition
hasValue() == true

◆ swap()

void original::alternative< void >::swap ( alternative< void > &  other)
inlinenoexcept

Swaps contents with another alternative<void>

Parameters
otherAlternative to swap with
Note
No-throw guarantee

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