4.6.0
Freundlich's C++ toolkit
|
Classes | |
struct | is_object |
Checks if a given type is an fcppt::optional::object. More... | |
struct | is_object< fcppt::optional::object< Type > > |
struct | nothing |
A polymorphic empty optional. More... | |
class | object |
A class that makes values optional. More... | |
Typedefs | |
template<fcppt::optional::object_concept Optional> | |
using | move_type = fcppt::move_if_rvalue_type<Optional, fcppt::optional::reference_type<Optional>> |
The moved inner type of an optional. | |
template<typename T > | |
using | reference = fcppt::optional::object<fcppt::reference<T>> |
Optional of a reference. | |
template<fcppt::optional::object_concept Optional> | |
using | reference_type = decltype(std::declval<Optional>().get_unsafe()) |
The reference type of an optional. | |
template<fcppt::optional::object_concept Optional> | |
using | value_type = fcppt::type_traits::value_type<std::remove_cvref_t<Optional>> |
The value type of an optional. | |
Functions | |
template<fcppt::optional::object_concept Optional, fcppt::concepts::invocable_move<> Function> requires std::is_same_v<std::remove_cvref_t<Optional>, std::invoke_result_t<Function>> | |
std::remove_cvref_t< Optional > | alternative (Optional &&_optional1, Function const &_optional2) |
Returns the first optional if it is not nothing. | |
template<fcppt::optional::object_concept... Optionals, fcppt::concepts::invocable_move< fcppt::optional::move_type< Optionals >... > Function> | |
fcppt::optional::object< std::invoke_result_t< Function, fcppt::optional::move_type< Optionals >... > > | apply (Function const &_function, Optionals &&..._optionals) |
Applies a function to multiple optionals if each of them contains a value. | |
template<typename Element , typename Arg > requires std::is_same_v<Element, std::remove_cv_t<Arg>> | |
Element & | assign (fcppt::optional::object< Element > &_optional, Arg &&_arg) |
Assigns an optional and returns a reference to the optional's contents. | |
template<fcppt::optional::object_concept Optional, fcppt::concepts::invocable_move< fcppt::optional::move_type< Optional > > Function> requires fcppt::optional::is_object_v< std::invoke_result_t<Function, fcppt::optional::move_type<Optional>>> | |
std::invoke_result_t< Function, fcppt::optional::move_type< Optional > > | bind (Optional &&_source, Function const &_function) |
Converts an optional of one type to another. | |
template<typename TargetContainer , typename Source > | |
TargetContainer | cat (Source &&_source) |
Removes empty optionals from a range. | |
template<fcppt::optional::object_concept Optional1, fcppt::optional::object_concept Optional2, fcppt::concepts::invocable_move< fcppt::optional::move_type< Optional1 >, fcppt::optional::move_type< Optional2 > > Function> requires std:: is_same_v<fcppt::optional::value_type<Optional1>, fcppt::optional::value_type<Optional2>> && std::is_same_v< fcppt::optional::value_type<Optional1>, std::invoke_result_t< Function, fcppt::optional::move_type<Optional1>, fcppt::optional::move_type<Optional2>>> | |
fcppt::optional::object< fcppt::optional::value_type< Optional1 > > | combine (Optional1 &&_optional1, Optional2 &&_optional2, Function const &_function) |
Combines two optionals. | |
template<typename T > | |
bool | operator== (fcppt::optional::object< T > const &_a, fcppt::optional::object< T > const &_b) |
Compares two optionals for equality. | |
template<typename T > | |
bool | operator!= (fcppt::optional::object< T > const &_a, fcppt::optional::object< T > const &_b) |
Compares two optionals for inequality. | |
template<typename Type > | |
fcppt::optional::object< std::remove_cv_t< Type > > | copy_value (fcppt::optional::reference< Type > const &_opt) |
Copies the value of an optional reference. | |
template<typename Element > | |
fcppt::optional::object< fcppt::reference< std::remove_reference_t< decltype(*std::declval< Element >())> > | deref (fcppt::optional::object< Element > const &_optional) |
Dereferences the contents of an optional. | |
template<fcppt::optional::object_concept Optional, fcppt::concepts::invocable_move< fcppt::optional::value_type< Optional > > Function> requires std::is_same_v<bool, std::invoke_result_t<Function, fcppt::optional::value_type<Optional>>> | |
std::remove_cvref_t< Optional > | filter (Optional &&_source, Function const &_function) |
Filters an optional. | |
template<fcppt::optional::object_concept Optional, fcppt::concepts::invocable_move Default> requires std::is_same_v<std::invoke_result_t<Default>, fcppt::optional::value_type<Optional>> | |
std::invoke_result_t< Default > | from (Optional &&_optional, Default const &_default) |
Returns the value contained in an optional or a default value. | |
template<typename T > | |
fcppt::optional::reference< T > | from_pointer (T *const _pointer) |
Creates an optional reference from a pointer. | |
template<typename Element , fcppt::concepts::invocable_move<> Function> requires std::is_same_v<std::invoke_result_t<Function>, Element> | |
Element & | get_or_assign (fcppt::optional::object< Element > &_optional, Function const &_function) |
Assigns an optional if it is empty. Returns a reference to the optional's contents. | |
template<fcppt::optional::object_concept Optional> requires fcppt::optional::is_object_v<fcppt::optional::value_type<Optional>> | |
fcppt::optional::value_type< Optional > | join (Optional &&_source) |
Removes one layer of optionals. | |
template<typename Type > | |
fcppt::optional::object< std::remove_cvref_t< Type > > | make (Type &&_value) |
Wraps a value into an optional. | |
template<fcppt::concepts::invocable_move Function> | |
fcppt::optional::object< std::invoke_result_t< Function > > | make_if (bool const _is_set, Function const &_function) |
Creates an optional depending on a boolean. | |
template<fcppt::optional::object_concept Optional, fcppt::concepts::invocable_move< fcppt::optional::move_type< Optional > > Function> | |
fcppt::optional::object< std::invoke_result_t< Function, fcppt::optional::move_type< Optional > > > | map (Optional &&_source, Function const &_function) |
Maps over an optional using a function. | |
template<fcppt::optional::object_concept Optional, fcppt::concepts::invocable Default, fcppt::concepts::invocable< fcppt::optional::move_type< Optional > > Transform> requires std::is_same_v< std::invoke_result_t<Default>, std::invoke_result_t<Transform, fcppt::optional::move_type<Optional>>> | |
std::invoke_result_t< Default > | maybe (Optional &&_optional, Default const &_default, Transform const &_transform) |
Transforms an optional value or returns a default value. | |
template<fcppt::optional::object_concept... Optionals, fcppt::concepts::invocable Default, fcppt::concepts::invocable< fcppt::optional::move_type< Optionals >... > Transform> requires std::is_same_v< std::invoke_result_t<Default>, std::invoke_result_t<Transform, fcppt::optional::move_type<Optionals>...>> | |
std::invoke_result_t< Default > | maybe_multi (Default const _default, Transform const _transform, Optionals &&..._optionals) |
Transforms multiple optional values or returns a default value. | |
template<fcppt::optional::object_concept Optional, fcppt::concepts::invocable< fcppt::optional::move_type< Optional > > Transform> | |
void | maybe_void (Optional &&_optional, Transform const &_transform) |
Transforms an optional value or does nothing. | |
template<fcppt::optional::object_concept... Optionals, fcppt::concepts::invocable< fcppt::optional::move_type< Optionals >... > Transform> | |
void | maybe_void_multi (Transform const _transform, Optionals &&..._optionals) |
Transforms optional values or does nothing. | |
template<typename Type , typename Ch , typename Traits > | |
std::basic_ostream< Ch, Traits > & | operator<< (std::basic_ostream< Ch, Traits > &_stream, fcppt::optional::object< Type > const &_opt_value) |
Outputs an optional to a basic_ostream. | |
template<typename ResultContainer , typename Source > | |
fcppt::optional::object< ResultContainer > | sequence (Source &&_source) |
Turns a container of optionals into an optional container. | |
template<typename Container , fcppt::optional::object_concept Optional> requires std::is_same_v<fcppt::type_traits::value_type<Container>, fcppt::optional::value_type<Optional>> | |
Container | to_container (Optional &&_source) |
Puts the value of an optional into a container or returns an empty container. | |
template<fcppt::optional::object_concept Optional, fcppt::concepts::invocable_move MakeException> | |
fcppt::optional::move_type< Optional > | to_exception (Optional &&_optional, MakeException const &_make_exception) |
Returns the value contained in an optional or throws an exception. | |
template<typename T > | |
T * | to_pointer (fcppt::optional::reference< T > const _optional) |
Converts an optional reference to a pointer. | |
Variables | |
template<typename T > | |
constexpr bool | is_object_v = fcppt::optional::is_object<T>::value |
Checks if a given type is an fcppt::optional::object. | |