【发布时间】:2020-09-25 14:32:34
【问题描述】:
我有以下类定义:
template <int B>
class SparseBitvector
{
typedef typename std::vector<std::bitset<B>> BitsetVector;
public:
class iterator: public std::iterator<...>
{
public:
explicit iterator(..., BitsetVector::iterator* _chunksIt, ...) {...}
}
}
编译时出现此错误:
/project/powerset/src/powerset/sparse_bitvector.h:96:125: error: 'std::BitsetVector<std::bitset<(long unsigned int)B>, std::allocator<std::bitset<(long unsigned int)B> > >::iterator' is not a type
explicit iterator(SortedStaticSet<EHRule> *_offsets, std::vector<std::bitset<B>> *_chunks, SetElement* _offssetsIt, BitsetVector::iterator* _chunksIt, int _indInBitset)
是否允许在嵌套类中使用模板值?
如果没有,我是否还有其他错误?
【问题讨论】:
-
请发帖minimal reproducible example。
iterator<...>不是有效的 C++ 代码。
标签: c++ class templates iterator class-template