summaryrefslogtreecommitdiffstats
path: root/src/util/unordered-containers.h
blob: 0bda8191fca2f4daad3e1c173268b7322560daa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/** @file
 * @brief Compatibility wrapper for unordered containers.
 */
/* Authors:
 *   Jon A. Cruz <jon@joncruz.org>
 *   Krzysztof Kosiński <tweenk.pl@gmail.com>
 *
 * Copyright (C) 2010 Authors
 * Released under GNU GPL, read the file 'COPYING' for more information
 */

#ifndef SEEN_INK_UTIL_UNORDERED_CONTAINERS_H
#define SEEN_INK_UTIL_UNORDERED_CONTAINERS_H

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <glibmm/ustring.h>

#ifndef DOXYGEN_SHOULD_SKIP_THIS

#include <unordered_set>
#include <unordered_map>
#define INK_UNORDERED_SET std::unordered_set
#define INK_UNORDERED_MAP std::unordered_map
#define INK_HASH std::hash

namespace std {
template <>
struct hash<Glib::ustring> : public std::unary_function<Glib::ustring, std::size_t> {
    std::size_t operator()(Glib::ustring const &s) const {
        return hash<std::string>()(s.raw());
    }
};
} // namespace std

#else
/// Name (with namespace) of the unordered set template.
#define INK_UNORDERED_SET
/// Name (with namespace) of the unordered map template.
#define INK_UNORDERED_MAP
/// Name (with namespace) of the hash template.
#define INK_HASH

#endif

#endif // SEEN_SET_TYPES_H
/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :