[Groonga-mysql-commit] mroonga/mroonga [fix-for-visual-studio] doc coding-style: add about assignment

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Thu Oct 4 10:38:59 JST 2012


Kouhei Sutou	2012-03-15 17:13:28 +0900 (Thu, 15 Mar 2012)

  New Revision: 2793a5ab52691da6937c0903bdad84c13a8a5dd3
  https://github.com/mroonga/mroonga/commit/2793a5ab52691da6937c0903bdad84c13a8a5dd3

  Log:
    doc coding-style: add about assignment

  Modified files:
    doc/source/developer/coding_style.rst

  Modified: doc/source/developer/coding_style.rst (+31 -0)
===================================================================
--- doc/source/developer/coding_style.rst    2012-03-15 16:33:00 +0900 (2a0b109)
+++ doc/source/developer/coding_style.rst    2012-03-15 17:13:28 +0900 (90f2dec)
@@ -293,3 +293,34 @@ TODO: ちゃんと考える。
         this.age_ = object.age_;
       }
     }
+
+クラスの代入
+------------
+
+基本的に定義したクラスの代入を禁止する。
+
+よい例:
+
+    class MyClass
+    {
+    private:
+      MyClass &operator=(const MyClass &);
+    }
+
+悪い例(代入を禁止していない):
+
+    class MyClass
+    {
+    }
+
+悪い例(代入を使っている):
+
+    class MyClass
+    {
+      unsigned int age_;
+      MyClass &operator=(const MyClass &object)
+      {
+        age_ = object.age_;
+        return *this;
+      }
+    }
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-mysql-commit mailing list
アーカイブの一覧に戻る