How to initialize a dynamic memory in a non-standard way in C++?
<p>Say I have a class:</p>

<pre><code>class A
{
  private:
    const int * const v;
  public:
    A();
}
</code></pre>

<p>I want <code>v</code> to be allocated in the initialization list, and I think I can define the following constructor:</p>

<pre><code>A::A():v((int*)malloc(10*sizeof(int))){}
</code></pre>

<p>However, what about v has to be allocated in a non-standard way like the following:</p>

<pre><code>cudaMalloc(&amp;v,10*sizeof(int));
</code></pre>

<p>Note <code>cudaMalloc</code> is a CUDA API to allocate GPU memory.</p>
