title: Should I implement all my data classes as QSharedData and use it with QSharedDataPointer?
body: <p>I am a Qt beginner and need to write some data classes. Would it be a good approach to write all these classes as in the <code>QSharedDataPointer</code> example (<a href="http://doc.trolltech.com/4.3/qshareddatapointer.html#details" rel="nofollow">here</a>), or is this too much overhead (besides the fact it is more work)?</p>
  
  <p>My classes in nature a very much like the below <code>Employee</code> class. I'll have to deal with several hundreds of instances, not ten-thousands or millions. </p>
  
  <p>A motivation for me to use QSharedData / QShareDataPointer would be the simplification of manual memory management and having a common code style. But I am still not sure whether I oversee some caveats.</p>
  
  <p>From the <a href="http://doc.trolltech.com/4.3/qshareddatapointer.html#details" rel="nofollow">example</a>:</p>
  
  <pre><code>class EmployeeData : public QSharedData
   {
   public:
       EmployeeData();
       EmployeeData(const EmployeeData &amp;other);
       ~EmployeeData();
  
       int id;
       QString *name;
   };
  
   class Employee
   {
   public:
       Employee();
       Employee(int id, const QString &amp;name);
  
       void setId(int id) { d-&gt;id = id; }
       void setName(const QString &amp;name);
  
       int id() const { return d-&gt;id; }
       QString name() const;
  
   private:
       QSharedDataPointer&lt;EmployeeData&gt; d;
   };
  </code></pre>