Can you evaluate a constructor call to boolean with an overloaded bool()?
<p>Can a constructor call be evaluated to a boolean if the bool() operator is overloaded?</p>

<pre><code>class A
{
  public:
  A() {};
  operator bool() const { return true; }
}

main()
{
  if (A a = A())
  {
  // do stuff
  }
}
</code></pre>

<p>Is the above code valid, or do I need to implement main like:</p>

<pre><code>int main(int argc, const char* argv[])
{
A a();
if (a)
  {
  // do stuff
  }
}
</code></pre>

<p>This code is going to wind up all over the place in my code base, so less lines, increased legibility, and reduced scope are important, and would be improved by this.</p>

<p>Any ideas?</p>
