title: Can I delete class pointer copied using memcpy()?
body: <p>Is the following snippet of code valid?</p>
  
  <pre><code>class Foo
  {
  public:
      int a;
      SomeClass* pb;
  
      Foo() {...}
      Foo(const Foo&amp; rhs)
      {
           this-&gt;a = rhs.a;
           memcpy(this-&gt;pb, rhs.pb, sizeof(SomeClass));
      }
      ~Request()
      {
          delete this-&gt;pb; // Suppose pb is a result of copy constructor,
                           // Is this valid or is there a better way?
      }
  };
  </code></pre>