G++ 3.3.1 Specialization bug?
Carlo Wood
carlo@alinoe.com
Sat Aug 30 23:04:00 GMT 2003
On Sat, Aug 30, 2003 at 12:53:26PM +0800, Wu Yongwei wrote:
> #include <stddef.h>
#include <cstddef>
> #if __GNUC__ == 3 && __GNUC_MINOR__ > 0
> #include <ext/hash_map>
> namespace sgi {
> using __gnu_cxx::hash;
> using __gnu_cxx::hash_map;
> }
#define SGI_HASH_NAMESPACE __gnu_cxx
> #else
> #include <hash_map>
> namespace sgi {
> using std::hash;
> using std::hash_map;
> }
#define SGI_HASH_NAMESPACE std
> #endif
or just
namespace sgi {
using SGI_HASH_NAMESPACE::hash;
using SGI_HASH_NAMESPACE::hash_map;
}
once.
>
> struct my_obj {
> int _value;
> my_obj(int v) : _value(v) {}
> };
>
> namespace sgi {
namespace SGI_HASH_NAMESPACE {
> template <> struct hash<my_obj> {
> size_t operator()(const my_obj& r) {
> return r._value;
> }
> };
> }
>
> int main()
> {
> sgi::hash_map<my_obj, int> a;
> }
>
> This is really making life difficult when hash_map support is wanted.
>
> Any ideas?
--
Carlo Wood <carlo@alinoe.com>
More information about the Gcc
mailing list