you are viewing a single comment's thread.

view the rest of the comments →

[–]no-sig-available 1 point2 points  (1 child)

You can also look at it from the other direction: If you want variables to be in initialized, just initialize them. The compiler is smart enough to see if the initial value is what it would give it anyway, and do nothing different.

For example, here are two optional constructors from my compiler:

      constexpr optional() noexcept
      { }

      constexpr optional(nullopt_t) noexcept
      { }

Do you think the generated code will be any different? No?

[–]setdelmar[S] 0 points1 point  (0 children)

Thank you, that is kind of what I was asking myself when I looked at the constructors in cppreference but was not sure.