构造函数初始化列表中的执行顺序是否可确定?我知道成员中的成员顺序是这些成员初始化的顺序,但如果我有这样的场景:
class X()
{
X_Implementation* impl_;
};
and then providing that allocator is available:
X::X():impl_(Allocate(sizeof(X_Implementation)))//HERE I'M ALLOCATING <--1
,impl_(Construct<X_Implementation>(impl_))//AND HERE I'M CONSTRUCTING <--2
{
}
Run Code Online (Sandbox Code Playgroud)
但为了使这个可靠,这个顺序必须是从左到右.它是由GREAT BOOK OF std保证还是不保证?如果不是,我总是可以将第二条线移动到身体中.