Deal with tr1 being gone in c0x11 compilers

This commit is contained in:
Jean-Francois Dockes
2013-10-18 13:02:48 +02:00
parent 0ba71e0e39
commit e12d66865e
9 changed files with 353 additions and 211 deletions
+3
View File
@@ -111,3 +111,6 @@
#undef _FILE_OFFSET_BITS
#undef _LARGE_FILES
#undef HAVE_TR1_UNORDERED
#undef HAVE_CXX0X_UNORDERED
+5 -7
View File
@@ -23,8 +23,9 @@
#include <iostream>
#include <string>
#include <algorithm>
#include <tr1/unordered_set>
#include <cstring>
#include "unordered_defs.h"
using namespace std;
#include "textsplit.h"
#include "debuglog.h"
@@ -32,9 +33,6 @@
#include "utf8iter.h"
#include "uproplist.h"
using std::tr1::unordered_set;
using namespace std;
/**
* Splitting a text into words. The code in this file works with utf-8
@@ -60,9 +58,9 @@ static int charclasses[charclasses_size];
// of Unicode properties, but seems to do the job well enough in most
// common cases
static vector<unsigned int> vpuncblocks;
static unordered_set<unsigned int> spunc;
static unordered_set<unsigned int> visiblewhite;
static unordered_set<unsigned int> sskip;
static STD_UNORDERED_SET<unsigned int> spunc;
static STD_UNORDERED_SET<unsigned int> visiblewhite;
static STD_UNORDERED_SET<unsigned int> sskip;
class CharClassInit {
public:
+21
View File
@@ -0,0 +1,21 @@
#include "autoconfig.h"
#ifdef HAVE_CXX0X_UNORDERED
# include <unordered_map>
# include <unordered_set>
using std::tr1::unordered_map;
using std::tr1::unordered_set;
#define STD_UNORDERED_MAP std::unordered_map
#define STD_UNORDERED_SET std::unordered_set
#elif defined(HAVE_TR1_UNORDERED)
# include <tr1/unordered_map>
# include <tr1/unordered_set>
#define STD_UNORDERED_MAP std::tr1::unordered_map
#define STD_UNORDERED_SET std::tr1::unordered_set
#else
# include <map>
# include <set>
#define STD_UNORDERED_MAP std::map
#define STD_UNORDERED_SET std::set
#endif