I'm writing SkipList implementation in a STD-like way: using allocators, iterators, etc. Whole class is done and is working but right now I'm trying to write a header file for the class I made. My current header file content is:
template<class _MySkiplist>
class _Skiplist_const_iterator;
template<class _MySkiplist>
class _Skiplist_iterator;
template<class _Kty,
class _Pr,
class _Alloc>
class skiplist
{
typedef skiplist<_Kty, _Pr, _Alloc> _Myt;
typedef typename _Skiplist_const_iterator<_Myt> const_iterator;
typedef typename _Skiplist_iterator<_Myt> iterator;
typedef typename _Alloc::size_type size_type;
typedef std::pair<iterator, iterator> _Pairii;
typedef std::pair<iterator, bool> _Pairib;
skiplist();
skiplist(const _Alloc& _Al);
skiplist(const _Pr& _Pred);
skiplist(const _Pr& _Pred, const _Alloc& _Al);
~skiplist();
iterator begin();
const_iterator begin() const;
iterator end();
const_iterator end() const;
size_type size() const;
size_type max_size() const;
bool empty() const;
// _Pairib insert(_Kty& _val);
// _Pairib insert(const _Kty& _val);
size_type erase(const _Kty& x);
void clear();
_Pr key_comp() const;
_Pr value_comp() const;
iterator find(const _Kty& x);
size_type count(const _Kty& x) const;
iterator lower_bound(const _Kty& x) const;
iterator upper_bound(const _Kty& x) const;
// _Pairii equal_range(const _Kty& x) const;
_Alloc get_allocator() const;
};
I'm keeping getting following errors:
Error 1 error C2143: syntax error : missing ';' before '<'
Error 3 error C2238: unexpected token(s) preceding ';'
Error 5 error C2238: unexpected token(s) preceding ';'
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
All these errors refers to following two lines in header file:
typedef std::pair<iterator, iterator> _Pairii;
typedef std::pair<iterator, bool> _Pairib;
I'm running out of ideas why the errors occur.
typename
in the iteratortypedef
? – Bo Persson<utility>
header? – David Rodríguez - dribeas