Доброй всем ночи.
Вобщем имею код:
#include <map>
#include <iostream>
class ST
{
private:
int S;
int T;
public:
ST()
{ S=T=0; }
ST(int S0,int T0) : S(S0), T(T0)
{ }
virtual ~ST()
{ }
int GetState() const
{return S;}
int GetTransition() const
{return T;}
void SetState(int Value)
{S = Value;}
void SetTransition(int Value)
{T = Value;}
};
/* Функтор для проверки на эквивалентрость (Использую книгу Скотт Мейерс Эфективное использование STL) */
struct STDef :
public std::binary_function<const ST,const ST,bool>{
bool operator()(const ST ST1,const ST ST2) const
{
return ((ST1.GetState()<ST2.GetState())&&(ST1.GetTransition()<ST2.GetTransition()));
}
};
/* \Функтор */
int main()
{
ST a1(1,2),a2(1,1);
std::cout << a1.GetState() << " " <<a1.GetTransition() << std::endl;
std::cout << a2.GetState() << " " <<a2.GetTransition() << std::endl;
std::map <ST,int,STDef> s;
s.insert(std::pair <ST,int>(a1,1));
s.insert(std::pair <ST,int>(a2,2));
std ::cout << s[a1] << std::endl;
std ::cout << s[a2] << std::endl;
std::map <ST,int,STDef>::iterator iter = s.begin();
// Вот от сюда начинаются все проблемы
/* for( ; iter < s.end() ;++iter)
{
std::cout << *iter << std::endl;
};*/
return 0;
}
Суть проблемы
1 Я не могу использовать оператор iter < s.end()
2 Я не могу использовать оператор << *iter (Хотя при разыменовании итератора планирую получить тип int)
Не могли бы разяснить в чем проблема?