The preferred method of initializing is:
MyClass x; MyClass y(x);
instead of:
MyClass x; MyClass y = x;
This is in case the compiler does not optimize out the temporary when using 'y = x'.
Reference: More Exceptional C++ by Herb Sutter. Addison-Wesley, 2002., pp. 224-225.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment