C++ Builder XE2 - problem z cstring

0

Mam problem z tym fragmentem kodu w BCB:

#include <iostream>
#include <fstream>
#include <cstring>
#include <vector>
using namespace std;

class Osoba
{
	private:
		string imie;
		string nazwisko;
	public:
		........
		bool operator< (Osoba z)
		{
			if(z.nazwisko==nazwisko)
			{
				if (imie<z.imie) return(true);
				else return(false);
			}
			else
			{
				if (nazwisko<z.nazwisko) return(true);
				else return(false);
			}
		}
		
};

[BCC32 Error] sort.cpp(35): E2093 'operator==' not implemented in type 'string' for arguments of the same type
[BCC32 Error] sort.cpp(37): E2093 'operator<' not implemented in type 'string' for arguments of the same type

W g++ to przechodzi bezproblemowo. Są jakieś alternatywy dla tych operatorów w Embarcadero?

0

Dołączasz złą bibliotekę: powinno być string, a nie cstring. Jak sama nazwa wskazuje cstring jest do obsługi c-stringów, a Ty korzystasz z std::string.

0

What a fail!!!
Nie spostrzegłem... Dzięki

1 użytkowników online, w tym zalogowanych: 0, gości: 1