I'm writing a templated class, which involves use of iterators. I've found the many questions about how you need to typename an iterator if you're using it with a template, so I'm wondering why it's still not working.
#pragma once
#include <iterator>
#include <list>
#include <tuple>
template <class T>
class Quack
{
private:
std::list<T> data;
typename std::list<T>::iterator iter;
public:
Quack();
void insert(T dat);
std::tuple<T, T> poppop();
private:
//error: 'iter' does not name a type
iter binarySearch(T toFind, std::list<T>::iterator min, std::list<T>::iterator max);
};
I also tried typedef typename std::list<T>::iterator iter;
, but that throws up the error "std::list::iterator is not a type"
So given that I'm using typename
, what is it that I'm doing wrong?
I'm using g++ 4.4.5 with the argument -std=c++0x, if it's relevant.
Aucun commentaire:
Enregistrer un commentaire