This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: G++ 3.3.1 Specialization bug?
- From: Carlo Wood <carlo at alinoe dot com>
- To: Wu Yongwei <adah at netstd dot com>
- Cc: gcc at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Sat, 30 Aug 2003 13:24:58 +0200
- Subject: Re: G++ 3.3.1 Specialization bug?
- References: <3F502DC6.9010902@netstd.com>
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>