4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
fcppt::enum_ Namespace Reference

Classes

class  array
 An array indexed with an enum. More...
 
struct  from_string_impl
 
class  invalid
 Exception to use for invalid enums. More...
 
class  iterator
 
struct  max_value_impl
 Specialization point for max_value. More...
 
class  range
 A range over a contiguous enum. More...
 
struct  size_type_impl
 
struct  to_string_impl
 Customization point for fcppt::enum_::to_string. More...
 

Typedefs

template<typename Enum >
using is_object = std::is_enum<Enum>
 Checks if a type is usable with fcppt.enum.
 
template<typename Type , typename = std::enable_if_t<fcppt::enum_::is_object<Type>::value>>
using max_value = typename fcppt::enum_::max_value_impl<Type>::type
 The maximum enumerator in an enum.
 
template<typename Type , typename = std::enable_if_t<fcppt::enum_::is_object<Type>::value>>
using min_value = std::integral_constant<Type, fcppt::cast::int_to_enum<Type>(0)>
 The minimum enumerator in an enum.
 
template<typename Enum >
using names_array = fcppt::enum_::array<Enum, std::string_view>
 Array type for The names of an enum.
 
template<typename Type >
using size
 The number of enumerators in an enum.
 
template<typename Type >
using size_type = typename fcppt::enum_::size_type_impl<Type>::type
 The size type used to count the number of enumerators in an enum.
 

Functions

template<typename Enum , typename Value >
bool operator== (fcppt::enum_::array< Enum, Value > const &_a, fcppt::enum_::array< Enum, Value > const &_b)
 Compares two enum arrays for equality.
 
template<typename Enum , typename Value >
bool operator!= (fcppt::enum_::array< Enum, Value > const &_a, fcppt::enum_::array< Enum, Value > const &_b)
 Compares two enum arrays for inequality.
 
template<typename Array , typename Function >
Array array_init (Function const &_function)
 Constructs an array by calling a function with static enumerators.
 
template<typename Array , typename Function >
auto array_map (Array &&_source, Function const &_function) -> fcppt::enum_::array< typename std::remove_cvref_t< Array >::enum_type, decltype(_function(fcppt::move_if_rvalue< Array >(std::declval< fcppt::container::to_reference_type< std::remove_reference_t< Array > > >())))>
 Applies a function to every element of an enum_::array and returns an enum_::array of the results.
 
template<typename Ch , typename Traits , typename Enum , typename Value >
requires (fcppt::enum_::is_object<Enum>::value)
std::basic_ostream< Ch, Traits > & operator<< (std::basic_ostream< Ch, Traits > &_stream, fcppt::enum_::array< Enum, Value > const &_array)
 Outputs an enum array.
 
template<typename Enum , typename Value >
requires (std::is_unsigned_v<Value> && fcppt::enum_::is_object<Enum>::value)
fcppt::optional::object< Enum > from_int (Value const &_value) noexcept
 Cast an unsigned value to an enum.
 
template<typename Enum >
requires (fcppt::enum_::is_object<Enum>::value)
fcppt::optional::object< Enum > from_string (std::string_view const _string)
 Converts a string to an enum.
 
template<typename Enum , typename Value >
fcppt::optional::object< Enum > index_of_array (fcppt::enum_::array< Enum, Value > const &_array, Value const &_value)
 Returns the enum of the first element found in an enum array.
 
template<typename Ch , typename Traits , typename Enum >
requires (fcppt::enum_::is_object<Enum>::value)
std::basic_istream< Ch, Traits > & input (std::basic_istream< Ch, Traits > &_stream, Enum &_result)
 Reads an enum value from a stream.
 
template<typename Enum >
fcppt::enum_::invalid< Enum > make_invalid (Enum const _enum)
 
template<typename Enum >
fcppt::enum_::range< Enum > make_range () noexcept
 Creates an enum range over the whole enum.
 
template<typename Enum >
fcppt::enum_::range< Enum > make_range_start (Enum const _start) noexcept
 Creates an enum range with a custom start value.
 
template<typename Enum >
fcppt::enum_::range< Enum > make_range_start_end (Enum const _start, Enum const _end) noexcept
 Creates a closed enum range.
 
template<typename Enum >
requires (fcppt::enum_::is_object<Enum>::value)
fcppt::enum_::names_array< Enum > names ()
 The names of an enum type.
 
template<typename Ch , typename Traits , typename Enum >
requires (fcppt::enum_::is_object<Enum>::value)
std::basic_ostream< Ch, Traits > & output (std::basic_ostream< Ch, Traits > &_stream, Enum const _value)
 Outputs an enum value to a stream.
 
template<typename Enum , typename Function >
requires (fcppt::enum_::is_object<Enum>::value)
decltype(auto) to_static (Enum const _enum, Function const &_function)
 Converts a runtime enum value into a compile time one, passing it to a function.
 
template<typename Enum >
requires (fcppt::enum_::is_object<Enum>::value)
std::string_view to_string (Enum const _enum)
 Converts an enum to a string.
 

Typedef Documentation

◆ is_object

template<typename Enum >
using fcppt::enum_::is_object = std::is_enum<Enum>

Checks if a type is usable with fcppt.enum.