如果直接这样写:

std::vector<boost::shared_ptr<int>> intvec;

gcc编译器会把">>"当成operator,报错:boost vector  error: ‘>>’ should be ‘> >’ within a nested template argument list

 

正确做法是加上空格:

std::vector<boost::shared_ptr<int> > intvec;

 

不过VS2010测试下不加空格也可以的。

相关文章: