2004-09-01 22:55:40 +00:00
|
|
|
//===-- llvm/ADT/hash_set - "Portable" wrapper around hash_set --*- C++ -*-===//
|
2003-10-20 19:46:57 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 22:59:10 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2003-10-20 19:46:57 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2003-08-15 20:01:10 +00:00
|
|
|
// vim:ft=cpp
|
2002-07-24 21:25:34 +00:00
|
|
|
//
|
|
|
|
// This file provides a wrapper around the mysterious <hash_set> header file
|
|
|
|
// that seems to move around between GCC releases into and out of namespaces at
|
|
|
|
// will. #including this header will cause hash_set to be available in the
|
|
|
|
// global namespace.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2004-09-01 22:55:40 +00:00
|
|
|
#ifndef LLVM_ADT_HASH_SET
|
|
|
|
#define LLVM_ADT_HASH_SET
|
2002-07-25 15:00:43 +00:00
|
|
|
|
2002-07-25 15:23:20 +00:00
|
|
|
// Compiler Support Matrix
|
|
|
|
//
|
|
|
|
// Version Namespace Header File
|
|
|
|
// 2.95.x :: hash_set
|
|
|
|
// 3.0.4 std ext/hash_set
|
|
|
|
// 3.1 __gnu_cxx ext/hash_set
|
2005-01-16 02:58:39 +00:00
|
|
|
// HP aCC6 std stdex/rw/hashset.h
|
2005-10-26 15:02:21 +00:00
|
|
|
// MS VC++ stdext hash_set
|
2002-07-25 15:23:20 +00:00
|
|
|
|
2004-09-24 18:28:00 +00:00
|
|
|
#undef HAVE_GNU_EXT_HASH_SET
|
|
|
|
#undef HAVE_STD_EXT_HASH_SET
|
|
|
|
#undef HAVE_GLOBAL_HASH_SET
|
2005-01-16 02:58:39 +00:00
|
|
|
#undef HAVE_RW_STDEX_HASH_SET_H
|
2004-09-24 18:28:00 +00:00
|
|
|
|
2003-11-10 03:06:09 +00:00
|
|
|
// GCC versions 3.1 and later put hash_set in <ext/hash_set> and in
|
|
|
|
// the __gnu_cxx namespace.
|
2004-09-24 18:28:00 +00:00
|
|
|
#if HAVE_GNU_EXT_HASH_SET
|
2003-11-10 03:06:09 +00:00
|
|
|
# include <ext/hash_set>
|
|
|
|
# ifndef HASH_NAMESPACE
|
|
|
|
# define HASH_NAMESPACE __gnu_cxx
|
|
|
|
# endif
|
2003-06-30 21:59:07 +00:00
|
|
|
|
2003-11-10 03:06:09 +00:00
|
|
|
// GCC 3.0.x puts hash_set in <ext/hash_set> and in the std namespace.
|
2004-09-24 18:28:00 +00:00
|
|
|
#elif HAVE_STD_EXT_HASH_SET
|
2003-11-10 03:06:09 +00:00
|
|
|
# include <ext/hash_set>
|
|
|
|
# ifndef HASH_NAMESPACE
|
|
|
|
# define HASH_NAMESPACE std
|
|
|
|
# endif
|
2002-07-25 15:00:43 +00:00
|
|
|
|
2003-11-10 03:06:09 +00:00
|
|
|
// Older compilers such as GCC before version 3.0 do not keep
|
|
|
|
// extensions in the `ext' directory, and ignore the `std' namespace.
|
2004-09-24 18:28:00 +00:00
|
|
|
#elif HAVE_GLOBAL_HASH_SET
|
2003-11-10 03:06:09 +00:00
|
|
|
# include <hash_set>
|
|
|
|
# ifndef HASH_NAMESPACE
|
|
|
|
# define HASH_NAMESPACE std
|
|
|
|
# endif
|
2003-06-30 21:59:07 +00:00
|
|
|
|
2005-01-16 02:58:39 +00:00
|
|
|
// HP aCC doesn't include an SGI-like hash_set. For this platform (or
|
|
|
|
// any others using Rogue Wave Software's Tools.h++ library), we wrap
|
|
|
|
// around them in std::
|
|
|
|
#elif HAVE_RW_STDEX_HASH_SET_H
|
|
|
|
# include <rw/stdex/hashset.h>
|
|
|
|
# ifndef HASH_NAMESPACE
|
|
|
|
# define HASH_NAMESPACE std
|
|
|
|
# endif
|
|
|
|
|
2005-10-26 14:48:53 +00:00
|
|
|
// Support Microsoft VC++.
|
|
|
|
#elif defined(_MSC_VER)
|
|
|
|
# include <hash_set>
|
|
|
|
# ifndef HASH_NAMESPACE
|
|
|
|
# define HASH_NAMESPACE stdext
|
|
|
|
# endif
|
|
|
|
|
2003-11-10 03:06:09 +00:00
|
|
|
// Give a warning if we couldn't find it, instead of (or in addition to)
|
|
|
|
// randomly doing something dumb.
|
2003-06-30 21:59:07 +00:00
|
|
|
#else
|
2003-11-10 03:06:09 +00:00
|
|
|
# warning "Autoconfiguration failed to find the hash_set header file."
|
2002-07-25 15:00:43 +00:00
|
|
|
#endif
|
2002-07-24 22:20:00 +00:00
|
|
|
|
2005-01-16 02:58:39 +00:00
|
|
|
// we wrap Rogue Wave Tools.h++ rw_hashset into something SGI-looking, here:
|
|
|
|
#ifdef HAVE_RW_STDEX_HASH_SET_H
|
|
|
|
namespace HASH_NAMESPACE {
|
|
|
|
|
|
|
|
/*
|
|
|
|
template <class DataType> struct hash {
|
|
|
|
unsigned int operator()(const unsigned int& x) const {
|
2007-04-16 18:10:23 +00:00
|
|
|
return x;
|
2005-01-16 02:58:39 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
|
|
|
|
template <typename ValueType,
|
2005-08-24 10:57:30 +00:00
|
|
|
class _HashFcn = hash<ValueType>,
|
|
|
|
class _EqualKey = equal_to<ValueType>,
|
|
|
|
class _A = allocator <ValueType> >
|
|
|
|
class hash_set :
|
|
|
|
public rw_hashset<ValueType, class _HashFcn, class _EqualKey, class _A> {
|
2005-01-16 02:58:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end HASH_NAMESPACE;
|
|
|
|
#endif
|
|
|
|
|
2002-07-24 22:20:00 +00:00
|
|
|
using HASH_NAMESPACE::hash_set;
|
|
|
|
|
2003-07-25 15:08:08 +00:00
|
|
|
// Include vector because ext/hash_set includes stl_vector.h and leaves
|
|
|
|
// out specializations like stl_bvector.h, causing link conflicts.
|
2003-07-25 14:06:13 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2004-10-04 18:10:18 +00:00
|
|
|
#include "llvm/ADT/HashExtras.h"
|
2002-11-08 14:07:33 +00:00
|
|
|
|
2002-07-24 22:20:00 +00:00
|
|
|
#endif
|