[Groonga-mysql-commit] mroonga/mroonga [master] doc coding-style: add about copy constructor

Back to archive index

null+****@clear***** null+****@clear*****
2012年 3月 15日 (木) 16:33:00 JST


Kouhei Sutou	2012-03-15 16:33:00 +0900 (Thu, 15 Mar 2012)

  New Revision: e1c194f8805b2810ad6fff6b4b960f6a4c28a9f0

  Log:
    doc coding-style: add about copy constructor

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

  Modified: doc/source/developer/coding_style.rst (+29 -0)
===================================================================
--- doc/source/developer/coding_style.rst    2012-03-15 15:59:09 +0900 (f85d1d8)
+++ doc/source/developer/coding_style.rst    2012-03-15 16:33:00 +0900 (2a0b109)
@@ -264,3 +264,32 @@ TODO: ちゃんと考える。
       };
     }
 
+コピーコンストラクタ
+--------------------
+
+基本的にコピーコンストラクタの使用を禁止する。
+
+よい例:
+
+    class MyClass
+    {
+    private:
+      MyClass(const MyClass &);
+    }
+
+悪い例(コピーコンストラクタを禁止していない):
+
+    class MyClass
+    {
+    }
+
+悪い例(カスタムコピーコンストラクタを使っている):
+
+    class MyClass
+    {
+      unsigned int age_;
+      MyClass(const MyClass &object)
+      {
+        this.age_ = object.age_;
+      }
+    }




Groonga-mysql-commit メーリングリストの案内
Back to archive index