xErY
Erfahrenes Mitglied
ich habe
und er sagt mir
In file included from Teams.h:4,
from repasm.cpp:14:
CTwoPlayer.h:46: Fehler: an explicit specialization must be preceded by 'template <>'
make: *** [repasm.o] Error 1
ich verstehe das nicht mag mir wer helfen bitte
Code:
#ifndef __PHP_EXT__TWOPLAYER
#define __PHP_EXT__TWOPLAYER
#ifdef __GNUC__
#if (__GNUC__ >= 3)
#include <ext/hash_map>
#else
#include <hash_map>
#endif
#endif
#include <stddef.h>
class CTwoPlayer {
public:
CTwoPlayer(int _p1, int _p2) {
p1 = _p1;
p2 = _p2;
}
operator size_t() const { return (size_t)(p1 | (p2<<16));};
bool operator < (const CTwoPlayer &r) const {
if (p1 < r.p1) return true;
else if (p1 == r.p1 && p2 < r.p2) return true;
return false;
}
int getP1() const { return p1;}
int getP2() const { return p2;}
private:
int p1, p2;
};
//Hash code computation. Note how it's easy and pleasant to do portable code....
#ifdef __GNUC__
#if (__GNUC__ >= 3)
namespace __gnu_cxx {
struct hash<CTwoPlayer>
{
size_t operator()(const ::CTwoPlayer &truc) const { return (size_t)(truc); }
};
};
#else
namespace std {
__STL_TEMPLATE_NULL struct hash<CTwoPlayer>
{
size_t operator()(const ::CTwoPlayer &truc) const { return (size_t)(truc); }
};
}
#endif // __GNUC__ >= 3
#endif // __GNUC__
#endif // __PHP_EXT__TWOPLAYER
und er sagt mir
In file included from Teams.h:4,
from repasm.cpp:14:
CTwoPlayer.h:46: Fehler: an explicit specialization must be preceded by 'template <>'
make: *** [repasm.o] Error 1
ich verstehe das nicht mag mir wer helfen bitte