src
libmoot
mootSTLHacks.h
Go to the documentation of this file.
1
/*-*- Mode: C++ -*-*/
2
3
/*
4
libmoot : moocow's part-of-speech tagging library
5
Copyright (C) 2003-2009 by Bryan Jurish <moocow@cpan.org>
6
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public
9
License as published by the Free Software Foundation; either
10
version 3 of the License, or (at your option) any later version.
11
12
This library is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Lesser General Public License for more details.
16
17
You should have received a copy of the GNU Lesser General Public
18
License along with this library; if not, write to the Free Software
19
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
*/
21
22
/*----------------------------------------------------------------------
23
* Name: mootSTLHacks.h
24
* Author: Bryan Jurish <moocow@cpan.org>
25
* Description:
26
* + STL hacks for libmoot
27
*----------------------------------------------------------------------*/
28
34
#ifndef _MOOT_STL_HACKS_H
35
#define _MOOT_STL_HACKS_H
36
37
#if defined(__GNUC__)
38
# if __GNUC__ >= 3
/* gcc >= v3.0 */
39
# if __GNUC__ == 3 && __GNUC_MINOR__ == 0
/* gcc == v3.0 */
40
# define moot_STL_NAMESPACE std
41
# else
/* !( __GNUC__ == 3 && __GNUC_MINOR__ == 0 ) */
/* gcc > v3.0 */
42
# define moot_STL_NAMESPACE __gnu_cxx
43
# endif
/* ( __GNUC__ == 3 && __GNUC_MINOR__ == 0 ) */
44
# include <ext/hash_map>
45
# include <ext/hash_set>
46
# else
/* !( __GNUC__ >= 3 ) */
/* gcc < v3.0 */
47
# define moot_STL_NAMESPACE std
48
# include <hash_map>
49
# include <hash_set>
50
# endif
/* ( __GNUC__ >= 3 ) */
51
52
# ifndef MOOT_HAVE_HASH_STRING
53
/*-- hack for string hashing --*/
54
namespace
moot_STL_NAMESPACE {
55
template
<>
struct
hash<std::string> {
56
std::size_t operator()(
const
std::string &__s)
const
{
57
return
__stl_hash_string(__s.c_str());
58
}
59
};
60
};
61
# endif // MOOT_HAVE_HASH_STRING
62
63
#else
/* !( defined(__GNUC__) ) */
64
# include <hash_map>
65
# include <hash_set>
66
# define moot_STL_NAMESPACE std
67
#endif
/* ( defined(__GNUC__) ) */
68
69
/* Namespace definitions */
70
#define moot_NAMESPACE moot
71
#define moot_BEGIN_NAMESPACE namespace moot {
72
#define moot_END_NAMESPACE };
73
74
/* gcc6 workaround for "error: reference to 'hash' is ambiguous" using hash<TYPE> */
75
#define moot_hash moot_STL_NAMESPACE::hash
76
77
#endif // _MOOT_STL_HACKS_H
Generated by
1.8.13