You need to do the second. Delegating constructors only works in the constructor’s initialization list, otherwise you’ll just create a temporary or do other mistakes like you mentioned.
More Related Contents:
- Legality of COW std::string implementation in C++11
- How to pass parameters correctly?
- Overload resolution between object, rvalue reference, const reference
- How to parse a date string into a c++11 std::chrono time_point or similar?
- How do I get the argument types of a function pointer in a variadic template class?
- How true is “Want Speed? Pass by value”
- C++11 auto: what if it gets a constant reference?
- How can I reliably get an object’s address when operator& is overloaded?
- Set precision of std::to_string when converting floating point values [duplicate]
- Parameter pack must be at the end of the parameter list… When and why?
- Can lambda functions be templated?
- Why do we copy then move?
- Get pointer to object from pointer to some member
- What is the difference between MinGW, MinGW-w64 and MinGW-builds?
- Disambiguate overloaded member function pointer being passed as template parameter
- Why do objects returned from bind ignore extra arguments?
- std::shared_ptr thread safety explained
- What does `auto && e` do in range-based for-loops?
- What happens if ‘throw’ fails to allocate memory for exception object?
- What is the purpose of a declaration like int (x); or int (x) = 10;
- Does C++11 allow dollar signs in identifiers?
- How can I resize a 2D vector of objects given the width and height?
- Why is there no std::protect?
- Implementation of Permutation, Combinations and PowerSet in C++ [duplicate]
- Idiomatic Way to declare C++ Immutable Classes
- std::this_thread::sleep_for() and GCC
- Why isn’t std::array::size static?
- Why is reinterpret_cast not constexpr?
- How to initialize all tuple elements by the same arguments?
- Is it possible to write an agile Pimpl in c++?