copy/conversion constructor definitions (const/non-const)
<p>Let me demonstrate with a simple example:</p>

<pre><code>class A
{
public:
  A() { cout &lt;&lt; "A::A()" &lt;&lt; endl; }
  A(A const&amp; a) : _a(a._a) { cout &lt;&lt; "A::(A Copy Const)" &lt;&lt; endl; }
  A(A&amp; a) : _a(a._a) { cout &lt;&lt; "A::(A Copy)" &lt;&lt; endl; }

  template &lt;typename _T1&gt;
  A(_T1&amp; v1) : _a(v1) { cout &lt;&lt; "A::(T conversion)" &lt;&lt; endl; }

  ~A() { cout &lt;&lt; "A::~A()" &lt;&lt; endl; }

  void say() { cout &lt;&lt; "A::say()" &lt;&lt; endl; }

private:
  int _a;
};

int main(int argc, char* argv[])
{
  A a1(A(argc)); // Line 1: ERM?

  a1.say();

  return 0;
}
</code></pre>

<p>Couple of things:</p>

<p>Is there any harm in defining a const and non-const version of the copy constructor? Reason I've done this is that this apparently helps the compiler differentiate from the templated constructor, i.e.</p>

<pre><code>A const a1(argc);
A a2(a1); // &lt;-- correctly call the const copy ctor

A a3(argc);
A a4(a3); // &lt;-- correctly call the non-const copy ctor
</code></pre>

<p>Is there a better way to ensure that in the above example, the copy constructor is always called over the templated constructor?</p>

<p>Secondly, from a pure coding perspective, Line 1 appears to be okay, the intention is to create a temporary <code>A</code> with <code>argc</code>, and then trigger the copy constructor, however I get the following exception (gcc 4.4.4):</p>

<p><em>error: request for member ‘say’ in ‘a1’, which is of non-class type ‘A(A)’</em></p>

<p>I believe that what's happening here is that the compiler thinks that <code>a1</code> is a function definition, is this correct? If so, what is the correct way to write that particular line of code? The following appears to be a hack!</p>

<pre><code>A a1(true ? A(argc) : A());
</code></pre>

<p>p.s. Please ignore all stylistic foobars and why exactly I want to do this...! :)</p>
