这是类声明的摘录:
template<typename key_type,typename value_type>
class _IndexTupleTree_Iterator
{
public:
typedef typename std::vector<value_type>::iterator value_it_t;
_IndexTupleTree_Iterator(std::vector<GenNode<key_type,value_type>*>& node_stack,std::vector<int>& key_pos_stack,value_it_t value_pos);
...
}
我尝试在下面的上下文中调用上述构造函数(最后一行):
template<typename key_type,typename value_type>
class LeafNode : public GenNode<key_type,value_type>
{
public:
typedef std::pair< std::vector<key_type>,value_type > entry_t;
LeafNode(const entry_t entry);
void insert(const entry_t entry);
_IndexTupleTree_Iterator<key_type,value_type> begin(std::vector<GenNode<key_type,value_type>*>& node_stack,std::vector<int>& key_pos_stack) const;
bool operator==(const LeafNode<key_type,value_type>& rhs) const;
//bool find(std::vector<key_type> key, _IndexTupleTree_Iterator& pos);
private:
std::vector<value_type> _values;
};
template<typename key_type,typename value_type>
_IndexTupleTree_Iterator<key_type,value_type> LeafNode<key_type,value_type>::begin(std::vector<GenNode<key_type,value_type>*>& node_stack,std::vector<int>& key_pos_stack) const
{
key_pos_stack.push_back(0);
return _IndexTupleTree_Iterator<key_type,value_type>(node_stack,key_pos_stack, _values.begin());
}
但我收到以下错误:
../src/tensor_utils/IndexTupleTree.h:134: error: no matching function for call to ‘_IndexTupleTree_Iterator<int, int>::_IndexTupleTree_Iterator(std::vector<GenNode<int, int>*, std::allocator<GenNode<int, int>*> >&, std::vector<int, std::allocator<int> >&, __gnu_cxx::__normal_iterator<const int*, std::vector<int, std::allocator<int> > >)’
../src/tensor_utils/IndexTupleTree.h:55: note: candidates are: _IndexTupleTree_Iterator<key_type, value_type>::_IndexTupleTree_Iterator(std::vector<GenNode<key_type, value_type>*, std::allocator<GenNode<key_type, value_type>*> >&, std::vector<int, std::allocator<int> >&, typename std::vector<value_type, std::allocator<_T2> >::iterator) [with key_type = int, value_type = int]
我知道问题出在最后一个论点上。有谁知道为什么它找不到构造函数并调用它?