1// (C) Copyright John Maddock 2001. 2// Use, modification and distribution are subject to the 3// Boost Software License, Version 1.0. (See accompanying file 4// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 6// See http://www.boost.org/libs/config for most recent version. 7 8// MACRO: BOOST_HAS_HASH 9// TITLE: <hashset> and <hashmap> 10// DESCRIPTION: The C++ implementation provides the (SGI) hash_set 11// or hash_map classes. 12 13#if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0 14# ifdef BOOST_NO_CXX11_STD_UNORDERED 15# define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx 16# define _BACKWARD_BACKWARD_WARNING_H 1 /* turn off warnings from the headers below */ 17# include <ext/hash_set> 18# include <ext/hash_map> 19# else 20 // If we have BOOST_NO_CXX11_STD_UNORDERED *not* defined, then we must 21 // not include the <ext/*> headers as they clash with the C++0x 22 // headers. ie in any given translation unit we can include one 23 // or the other, but not both. 24# define DISABLE_BOOST_HAS_HASH_TEST 25# endif 26#else 27#include <hash_set> 28#include <hash_map> 29#endif 30 31#ifndef BOOST_STD_EXTENSION_NAMESPACE 32#define BOOST_STD_EXTENSION_NAMESPACE std 33#endif 34 35namespace boost_has_hash{ 36 37#ifndef DISABLE_BOOST_HAS_HASH_TEST 38 39template <class Key, class Eq, class Hash, class Alloc> 40void foo(const BOOST_STD_EXTENSION_NAMESPACE::hash_set<Key,Eq,Hash,Alloc>& ) 41{ 42} 43 44template <class Key, class T, class Eq, class Hash, class Alloc> 45void foo(const BOOST_STD_EXTENSION_NAMESPACE::hash_map<Key,T,Eq,Hash,Alloc>& ) 46{ 47} 48 49#endif 50 51int test() 52{ 53#ifndef DISABLE_BOOST_HAS_HASH_TEST 54 BOOST_STD_EXTENSION_NAMESPACE::hash_set<int> hs; 55 foo(hs); 56 BOOST_STD_EXTENSION_NAMESPACE::hash_map<int, long> hm; 57 foo(hm); 58#endif 59 return 0; 60} 61 62} 63 64 65 66 67 68 69