Skip to main content

magic_enum::istream_operators

C++ API reference for the namespace magic_enum::istream_operators.

Public API

Free Function: operator>>

Canonical path: magic_enum::istream_operators::operator>>

Declared in: include/magic_enum/magic_enum_iostream.hpp

Signature

std::basic_istream<Char, Traits>& operator>>(std::basic_istream<Char, Traits>& is, E& value);

Summary

Input stream operator for reading enum values from a stream.

Behavior

The operator reads a string from the input stream and attempts to cast it to the enum type using enum_flags_cast for flags or enum_cast otherwise; if the cast fails or the type is unsupported, it sets the failbit on the stream.

Parameters

  • is: The input stream to read from.
  • value: The enum variable where the parsed value will be stored.

Returns

  • Return value 1: A reference to the input stream.