So, my question is simple:
Is there any point in specifying a defaulted class constructor as noexcept or constexpr (or any other thing you could thing of)?
struct foo
{
foo() = default;
// vs
constexpr foo() noexcept = default;
// same thing would apply for copy/move ctors and assignment operators
};
Would the two behave the same way?
Does it depend on whether the class is POD?
For example with the above example both would behave the same way, while if for example I had a private member std::vector<int> v = { 1, 2, 3, 4 }; which uses in-class assignment, foo() = default; would by default not be noexcept and not constexpr.
By writing foo() = default; does the compiler just pick the best version: noexcept if possible and constexpr if possible, etc?