以下代码无法在 MSVStudio 2010 Express 中编译,似乎是因为 boost 容器声明创建了包含类型的(静态?)实例。更改boost::ptr_list<TypeContained>
为std::list<TypeContained *>
使其编译成功,但我喜欢 boost 容器。任何人都知道我该如何解决这个问题?错误是error C2504: 'Proxy<TypeContainer,TypeContained>' : base class undefined
#include <string>
#include <boost/ptr_container/ptr_list.hpp>
template <typename TypeContainer, typename TypeContained>
class Proxy
{
private:
typename boost::ptr_list<TypeContained>::iterator m_clsPosition;
public:
class Container {};
};
template <typename V> class Container;
template <typename V>
class Dependent : public Proxy<Container<V>, Dependent<V> >,
public V {};
template <typename V>
class Container : public Proxy<Container<V>, Dependent<V> >::Container {};
int main(int argc, char * argv[])
{
Container<std::string> clsContainer;
return 0;
}