根据我的理解,下面的代码构造一个类型的对象,Foo然后将该对象移动到由分配的内存中std::make_shared
struct Foo
{
std::string s;
int i;
char c;
};
int main(int argc, char* argv[])
{
auto foo = std::make_shared<Foo>(Foo{"hello", 5, 'c' });
}
Run Code Online (Sandbox Code Playgroud)
是否可以将initialize Foo直接聚合到由std::make_shared?分配的内存中?