2
* @brief Compatibility wrapper for unordered containers.
5
* Jon A. Cruz <jon@joncruz.org>
6
* Krzysztof Kosiński <tweenk.pl@gmail.com>
8
* Copyright (C) 2010 Authors
9
* Released under GNU GPL, read the file 'COPYING' for more information
12
#ifndef SEEN_INK_UTIL_UNORDERED_CONTAINERS_H
13
#define SEEN_INK_UTIL_UNORDERED_CONTAINERS_H
19
#ifndef DOXYGEN_SHOULD_SKIP_THIS
20
#if defined(HAVE_TR1_UNORDERED_SET)
22
# include <tr1/unordered_set>
23
# include <tr1/unordered_map>
24
# define INK_UNORDERED_SET std::tr1::unordered_set
25
# define INK_UNORDERED_MAP std::tr1::unordered_map
26
# define INK_HASH std::tr1::hash
28
#elif defined(HAVE_BOOST_UNORDERED_SET)
29
# include <boost/unordered_set.hpp>
30
# include <boost/unordered_map.hpp>
31
# define INK_UNORDERED_SET boost::unordered_set
32
# define INK_UNORDERED_MAP boost::unordered_map
33
# define INK_HASH boost::hash
35
#elif defined(HAVE_EXT_HASH_SET)
37
# include <functional>
38
# include <ext/hash_set>
39
# include <ext/hash_map>
40
# define INK_UNORDERED_SET __gnu_cxx::hash_set
41
# define INK_UNORDERED_MAP __gnu_cxx::hash_map
42
# define INK_HASH __gnu_cxx::hash
45
// hash function for pointers
46
// TR1 and Boost have this defined by default, __gnu_cxx doesn't
48
struct hash<T *> : public std::unary_function<T *, std::size_t> {
49
std::size_t operator()(T *p) const {
51
std::size_t x = static_cast<std::size_t>(reinterpret_cast<std::ptrdiff_t>(p));
55
} // namespace __gnu_cxx
59
/// Name (with namespace) of the unordered set template.
60
#define INK_UNORDERED_SET
61
/// Name (with namespace) of the unordered map template.
62
#define INK_UNORDERED_MAP
63
/// Name (with namespace) of the hash template.
68
#endif // SEEN_SET_TYPES_H
72
c-file-style:"stroustrup"
73
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
78
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :