File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4092,6 +4092,44 @@ namespace pythonic
40924092 }
40934093 throw pythonic::PythonicTypeError (" operator^ requires integral types or sets/lists" );
40944094 }
4095+ // In-place bitwise AND
4096+ var &operator &=(const var &other) {
4097+ *this = *this & other;
4098+ return *this ;
4099+ }
4100+
4101+ // In-place bitwise OR
4102+ var &operator |=(const var &other) {
4103+ *this = *this | other;
4104+ return *this ;
4105+ }
4106+
4107+ // In-place bitwise XOR
4108+ var &operator ^=(const var &other) {
4109+ *this = *this ^ other;
4110+ return *this ;
4111+ }
4112+
4113+ // In-place bitwise AND with primitive
4114+ template <typename T, typename = std::enable_if_t <std::is_arithmetic_v<T>>>
4115+ var &operator &=(T other) {
4116+ *this = *this & var (other);
4117+ return *this ;
4118+ }
4119+
4120+ // In-place bitwise OR with primitive
4121+ template <typename T, typename = std::enable_if_t <std::is_arithmetic_v<T>>>
4122+ var &operator |=(T other) {
4123+ *this = *this | var (other);
4124+ return *this ;
4125+ }
4126+
4127+ // In-place bitwise XOR with primitive
4128+ template <typename T, typename = std::enable_if_t <std::is_arithmetic_v<T>>>
4129+ var &operator ^=(T other) {
4130+ *this = *this ^ var (other);
4131+ return *this ;
4132+ }
40954133
40964134 // Bool conversion
40974135 operator bool () const
You can’t perform that action at this time.
0 commit comments