T x(value)
is usually the better choice because it will directly initialize x with value, whereas T x = value
might create a temporary depending on the type of value.
You're almost right, the better choice is the clearest syntax. Here's how the two differ:
The form of initialization (using parentheses or =) is generally insignificant, but does matter when the entity being initialized has a class type... [8.5/11]
struct A {
A(int) {}
};
struct B {
explicit B(int) {}
};
int main() {
{ A obj (42); } // succeeds
{ A obj = 42; } // succeeds
{ B obj (42); } // succeeds
{ B obj = 42; } // fails
}
An implicit conversion is required, so things like vector<int> v = 3;
fail, but that looks wrong anyway, right? Any copy is likely elided. I can't remember finding this to be a bottleneck in anything I've written, and I stopped worrying about it long ago: just use the clearest syntax.
In the special case where value is of type T though, my guess is that the expression T x = value
will always result in exactly one copy constructor call. Am I correct?
No, you're not guaranteed that the copy ctor will always be called, but it must be accessible. For example, in your specific case above with value
being a function's return value, the standard explicitly allows those copies to be elided.