I want to initialize a bunch of members in-class to keep the source file cleaner. However, the objects take an argument I only receive via constructor and can initialize either in the constructor initialization list or in the constructor via assignment. (The second option would certainly not work.) This is basically the scenario:
In Header
class Foo
{
public:
Foo(Pointer * ptr);
private:
Pointer * ptr;
Member m1{ptr, "SomeText"};
Member m2{ptr, "SomeOtherText"};
}
In CPP
Foo::Foo(Pointer*ptr) :
ptr(ptr)
{
// ...
}
Now the question is: Does the standard say anything about the order of initialization between ptr and m1 / m2? Obviously, this code would only work when ptris initialized before m1 and m2.