2.10.0
Freundlich's C++ toolkit
Classes | Typedefs | Functions
fcppt::optional Namespace Reference

Classes

struct  is_object
 Checks if a given type is an fcppt::optional::object. More...
 
struct  nothing
 A polymorphic empty optional. More...
 
class  object
 A class that makes values optional. More...
 
struct  object< Type >>
 

Typedefs

template<typename T >
using reference = fcppt::optional::object< fcppt::reference< T > >
 Optional of a reference. More...
 
template<typename Optional >
using value_type = typename fcppt::optional::detail::value_type< Optional >::type
 The value type of an optional. More...
 

Functions

template<typename Optional , typename Function >
std::remove_reference_t< Optional > alternative (Optional &&_optional1, Function const &_optional2)
 Returns the first optional if it is not nothing. More...
 
template<typename Function , typename... Optionals>
auto apply (Function const &_function, Optionals &&... _optionals) -> fcppt::optional::object< decltype(_function(fcppt::move_if_rvalue< Optionals >(_optionals.get_unsafe())...)) >
 Applies a function to multiple optionals or returns nothing. More...
 
template<typename Element , typename Arg >
Element & assign (fcppt::optional::object< Element > &_optional, Arg &&_arg) FCPPT_PP_WARN_UNUSED_RESULT
 Assigns an optional and returns a reference to the optional's contents. More...
 
template<typename Optional , typename Function >
auto bind (Optional &&_source, Function const &_function) -> std::remove_reference_t< decltype(_function(fcppt::move_if_rvalue< Optional >(_source.get_unsafe()))) >
 Converts an optional of one type to another. More...
 
template<typename TargetContainer , typename Source >
TargetContainer cat (Source &&_source)
 Removes empty optionals from a range. More...
 
template<typename Optional , typename Function >
auto combine (Optional &&_optional1, Optional &&_optional2, Function const &_function) -> fcppt::optional::object< decltype(_function(fcppt::move_if_rvalue< Optional >(_optional1.get_unsafe()), fcppt::move_if_rvalue< Optional >(_optional2.get_unsafe()))) >
 Combines two optionals. More...
 
template<typename T >
bool operator== (fcppt::optional::object< T > const &_a, fcppt::optional::object< T > const &_b)
 Compares two optionals for equality. More...
 
template<typename T >
bool operator!= (fcppt::optional::object< T > const &_a, fcppt::optional::object< T > const &_b)
 Compares two optionals for inequality. More...
 
template<typename T >
bool operator< (fcppt::optional::object< T > const &_a, fcppt::optional::object< T > const &_b)
 Compares two optionals lexicographically. More...
 
template<typename Result , typename Arg >
fcppt::optional::reference< Result > const_cast_ (fcppt::optional::reference< Arg > const &_optional)
 Converts an optional reference using const_cast More...
 
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. More...
 
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. More...
 
template<typename Result , typename Arg >
fcppt::optional::reference< Result > dynamic_cast_ (fcppt::optional::reference< Arg > const &_optional)
 Converts an optional reference using dynamic_cast More...
 
template<typename Optional , typename Function >
fcppt::type_traits::remove_cv_ref_t< Optional > filter (Optional &&_source, Function const &_function)
 Filters an optional. More...
 
template<typename Optional , typename Default >
std::result_of_t< Default()> from (Optional &&_optional, Default const _default)
 Returns the value contained in an optional or a default value. More...
 
template<typename T >
fcppt::optional::reference< T > from_pointer (T *const _pointer)
 Creates an optional reference from a pointer. More...
 
template<typename Optional >
fcppt::optional::value_type< fcppt::type_traits::remove_cv_ref_t< Optional >> join (Optional &&_source)
 Removes one layer of optionals. More...
 
template<typename Type >
fcppt::optional::object< fcppt::type_traits::remove_cv_ref_t< Type >> make (Type &&_value)
 Wraps a value into an optional. More...
 
template<typename Function >
fcppt::optional::object< std::result_of_t< Function() >> make_if (bool const _is_set, Function const &_function)
 Creates an optional depending on a boolean. More...
 
template<typename Optional , typename Function >
auto map (Optional &&_source, Function const &_function) -> fcppt::optional::object< std::remove_cv_t< decltype(_function(fcppt::move_if_rvalue< Optional >(_source.get_unsafe()))) > >
 Maps over an optional using a function. More...
 
template<typename Optional , typename Default , typename Transform >
std::result_of_t< Default()> maybe (Optional &&_optional, Default const _default, Transform const _transform)
 Transforms an optional value or returns a default value. More...
 
template<typename Default , typename Transform , typename... Optionals>
std::result_of_t< Default()> maybe_multi (Default const _default, Transform const _transform, Optionals &&... _optionals)
 Transforms multiple optional values or returns a default value. More...
 
template<typename Optional , typename Transform >
void maybe_void (Optional &&_optional, Transform const _transform)
 Transforms an optional value or does nothing. More...
 
template<typename... Optionals, typename Transform >
void maybe_void_multi (Transform const _transform, Optionals &&... _optionals)
 Transforms optional values or does nothing. More...
 
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. More...
 
template<typename ResultContainer , typename Source >
fcppt::optional::object< ResultContainer > sequence (Source &&_source)
 Sequences a container of optionals. More...
 
template<typename Result , typename Arg >
fcppt::optional::reference< Result > static_cast_ (fcppt::optional::reference< Arg > const &_optional)
 Converts an optional reference using static_cast More...
 
template<typename Container , typename Optional >
Container to_container (Optional &&_source)
 Puts the value of an optional into a container or returns an empty container. More...
 
template<typename Optional , typename MakeException >
auto to_exception (Optional &&_optional, MakeException const _make_exception) -> decltype(fcppt::move_if_rvalue< Optional >(_optional.get_unsafe()))
 Returns the value contained in an optional or throws an exception. More...
 
template<typename T >
T * to_pointer (fcppt::optional::reference< T > const _optional)
 Converts an optional reference to a pointer. More...