小编ali*_*glu的帖子

enable_shared_from_这不适用于xcode 5

#include <iostream>
#include <memory>

template<typename T>
class Test: public std::enable_shared_from_this< Test<T> >
{

public:

    std::shared_ptr< Test<T> > getMe()
    {
        return shared_from_this();
    };

};

int main(int argc, const char * argv[])
{
    Test<int>   aTest;

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

当我尝试在Xcode 5上编译时,我得到了

Use of undeclared identifier 'shared_from_this'
Run Code Online (Sandbox Code Playgroud)

我测试了它并在Visual Studio 2010上工作.

c++ xcode llvm clang c++11

10
推荐指数
1
解决办法
1515
查看次数

标签 统计

c++ ×1

c++11 ×1

clang ×1

llvm ×1

xcode ×1