Skip to main content

magic_enum::bitwise_operators

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

Public API

Free Function: operator&

Canonical path: magic_enum::bitwise_operators::operator&

Declared in: include/magic_enum/magic_enum.hpp

Signature

constexpr E operator&(E lhs, E rhs) noexcept;

Summary

Bitwise AND operator for enums.

Behavior

Performs a bitwise AND operation between two enum values by casting them to their underlying types and then casting the result back to the enum type.

Parameters

  • lhs: The first enum operand.
  • rhs: The second enum operand.

Returns

  • Return value 1: Returns the result of the bitwise AND operation as the enum type.

Free Function: operator&=

Canonical path: magic_enum::bitwise_operators::operator&=

Declared in: include/magic_enum/magic_enum.hpp

Signature

constexpr E& operator&=(E& lhs, E rhs) noexcept;

Summary

Bitwise AND assignment operator for enums.

Behavior

Performs a bitwise AND operation on the left-hand side operand with the right-hand side operand and assigns the result back to the left-hand side.

Parameters

  • lhs: The left-hand side enum value to be modified.
  • rhs: The right-hand side enum value used for the bitwise AND operation.

Returns

  • Return value 1: Returns a reference to the modified left-hand side operand.

Free Function: operator^

Canonical path: magic_enum::bitwise_operators::operator^

Declared in: include/magic_enum/magic_enum.hpp

Signature

constexpr E operator^(E lhs, E rhs) noexcept;

Summary

Bitwise XOR operator for enums.

Behavior

Performs a bitwise XOR operation between two enum values by casting them to their underlying types and then casting the result back to the enum type.

Parameters

  • lhs: The first enum operand.
  • rhs: The second enum operand.

Returns

  • Return value 1: Returns the result of the bitwise XOR operation as the enum type.

Free Function: operator^=

Canonical path: magic_enum::bitwise_operators::operator^=

Declared in: include/magic_enum/magic_enum.hpp

Signature

constexpr E& operator^=(E& lhs, E rhs) noexcept;

Summary

Bitwise XOR assignment operator for enums.

Behavior

Performs a bitwise XOR operation on the left-hand side operand with the right-hand side operand and assigns the result back to the left-hand side.

Parameters

  • lhs: The left-hand side enum value to be modified.
  • rhs: The right-hand side enum value used for the bitwise XOR operation.

Returns

  • Return value 1: Returns a reference to the modified left-hand side operand.

Free Function: operator|

Canonical path: magic_enum::bitwise_operators::operator|

Declared in: include/magic_enum/magic_enum.hpp

Signature

constexpr E operator|(E lhs, E rhs) noexcept;

Summary

Bitwise OR operator for enums.

Behavior

Performs a bitwise OR operation between two enum values by casting them to their underlying types and then casting the result back to the enum type.

Parameters

  • lhs: The first enum operand.
  • rhs: The second enum operand.

Returns

  • Return value 1: Returns the result of the bitwise OR operation as the enum type.

Free Function: operator|=

Canonical path: magic_enum::bitwise_operators::operator|=

Declared in: include/magic_enum/magic_enum.hpp

Signature

constexpr E& operator|=(E& lhs, E rhs) noexcept;

Summary

Bitwise OR assignment operator for enums.

Behavior

Performs a bitwise OR operation on the left-hand side operand with the right-hand side operand and assigns the result back to the left-hand side.

Parameters

  • lhs: The left-hand side enum value to be modified.
  • rhs: The right-hand side enum value used for the bitwise OR operation.

Returns

  • Return value 1: Returns a reference to the modified left-hand side operand.

Free Function: operator~

Canonical path: magic_enum::bitwise_operators::operator~

Declared in: include/magic_enum/magic_enum.hpp

Signature

constexpr E operator~(E rhs) noexcept;

Summary

Bitwise NOT operator for enums.

Behavior

Performs a bitwise NOT operation on an enum value by casting it to its underlying type, applying the operator, and casting the result back to the enum type.

Parameters

  • rhs: The enum value to be negated.

Returns

  • Return value 1: Returns the bitwise NOT result as the enum type.