[Groonga-commit] groonga/grnxx at b85c98a [master] Use na_data() and na_size() instead of nullptr and 0. (#92)

Back to archive index

susumu.yata null+****@clear*****
Mon Oct 27 15:51:57 JST 2014


susumu.yata	2014-10-27 15:51:57 +0900 (Mon, 27 Oct 2014)

  New Revision: b85c98afbb99adf6aea22b3b6d4dc6843e0ec33e
  https://github.com/groonga/grnxx/commit/b85c98afbb99adf6aea22b3b6d4dc6843e0ec33e

  Message:
    Use na_data() and na_size() instead of nullptr and 0. (#92)

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

  Modified: include/grnxx/new_types/text.hpp (+6 -2)
===================================================================
--- include/grnxx/new_types/text.hpp    2014-10-27 11:52:17 +0900 (0fa111e)
+++ include/grnxx/new_types/text.hpp    2014-10-27 15:51:57 +0900 (3ebab25)
@@ -18,9 +18,10 @@ class Text {
   Text &operator=(const Text &) = default;
 
   explicit Text(const char *str)
-      : data_(str), size_(str ? std::strlen(str) : 0) {}
+      : data_(str),
+        size_(str ? std::strlen(str) : na_size()) {}
   constexpr Text(const char *data, size_t size) : data_(data), size_(size) {}
-  explicit constexpr Text(NA) : data_(nullptr), size_(0) {}
+  explicit constexpr Text(NA) : data_(na_data()), size_(na_size()) {}
 
   const char &operator[](size_t i) const {
     return data_[i];
@@ -110,6 +111,9 @@ class Text {
   static constexpr const char *na_data() {
     return nullptr;
   }
+  static constexpr size_t na_size() {
+    return 0;
+  }
 
  private:
   const char *data_;
-------------- next part --------------
HTML����������������������������...
Télécharger 



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