Rel*_*lla 2 c++ boost visual-studio-2008 visual-studio
由此:
// parts of c++0x std
#include <boost/bind.hpp>
#include <boost/function.hpp>
#ifndef _IGraphElement_h_
#define _IGraphElement_h_
using namespace std ;
template <typename DataType >
class IGraphElement : public IGraphElementBase{
typedef boost::function<void(DataType)> Function;
typedef std::vector<Function> FunctionSequence; // (line *)
typedef FunctionSequence::iterator FunctionIterator; // (line **)
//...
};
Run Code Online (Sandbox Code Playgroud)
我同时在线上获得C2146和C4430!(如何解决这个问题?
typedef FunctionSequence::iterator FunctionIterator; // (line **)
Run Code Online (Sandbox Code Playgroud)
这应写成,
typedef typename FunctionSequence::iterator FunctionIterator;
Run Code Online (Sandbox Code Playgroud)
由于iterator
是一个从属名称,所以typename
是必需的!
在此处阅读依赖名称: