[Groonga-commit] groonga/grnxx at 9dd1108 [master] Update unary assignment operators of Bool.

Back to archive index

susumu.yata null+****@clear*****
Thu Oct 23 18:28:08 JST 2014


susumu.yata	2014-10-23 18:28:08 +0900 (Thu, 23 Oct 2014)

  New Revision: 9dd11081df984a60c94cdd319eaec5a35783ddf6
  https://github.com/groonga/grnxx/commit/9dd11081df984a60c94cdd319eaec5a35783ddf6

  Message:
    Update unary assignment operators of Bool.

  Modified files:
    include/grnxx/new_types/bool.hpp

  Modified: include/grnxx/new_types/bool.hpp (+12 -7)
===================================================================
--- include/grnxx/new_types/bool.hpp    2014-10-23 17:12:59 +0900 (f1583db)
+++ include/grnxx/new_types/bool.hpp    2014-10-23 18:28:08 +0900 (78aa745)
@@ -60,13 +60,18 @@ class Bool {
   }
 
   Bool &operator&=(Bool rhs) & {
-    return *this = operator&(rhs);
-  }
-  Bool operator|=(Bool rhs) & {
-    return *this = operator|(rhs);
-  }
-  Bool operator^=(Bool rhs) & {
-    return *this = operator^(rhs);
+    value_ &= rhs.value_;
+    return *this;
+  }
+  Bool &operator|=(Bool rhs) & {
+    value_ |= rhs.value_;
+    return *this;
+  }
+  Bool &operator^=(Bool rhs) & {
+    if (!is_na()) {
+      value_ = rhs.is_na() ? na_value() : (value_ ^ rhs.value_);
+    }
+    return *this;
   }
 
   // -- Comparison operators --
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index