Skip to content

Commit 65c75ff

Browse files
committed
use std::unordered_set instead of boost::unordered_set for all instances in moses2. To avoid confusion
1 parent d3c2c0b commit 65c75ff

File tree

22 files changed

+23
-36
lines changed

22 files changed

+23
-36
lines changed

moses2/FF/StatefulFeatureFunction.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
* Author: hieu
66
*/
77

8-
#ifndef STATEFULFEATUREFUNCTION_H_
9-
#define STATEFULFEATUREFUNCTION_H_
8+
#pragma once
109

1110
#include "FeatureFunction.h"
1211
#include "FFState.h"
@@ -63,4 +62,3 @@ class StatefulFeatureFunction: public FeatureFunction
6362

6463
}
6564

66-
#endif /* STATEFULFEATUREFUNCTION_H_ */

moses2/FF/StatelessFeatureFunction.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
* Author: hieu
66
*/
77

8-
#ifndef STATELESSFEATUREFUNCTION_H_
9-
#define STATELESSFEATUREFUNCTION_H_
8+
#pragma once
109

1110
#include "FeatureFunction.h"
1211

@@ -22,4 +21,3 @@ class StatelessFeatureFunction: public FeatureFunction
2221

2322
}
2423

25-
#endif /* STATELESSFEATUREFUNCTION_H_ */

moses2/HypothesisColl.h

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77
#pragma once
88
#include <unordered_set>
9-
#include <boost/unordered_set.hpp>
109
#include "HypothesisBase.h"
1110
#include "MemPoolAllocator.h"
1211
#include "Recycler.h"

moses2/Main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void Temp()
107107
Moses2::MemPool pool;
108108
Moses2::MemPoolAllocator<int> a(pool);
109109

110-
boost::unordered_set<int, boost::hash<int>, std::equal_to<int>, Moses2::MemPoolAllocator<int> > s(a);
110+
std::unordered_set<int, boost::hash<int>, std::equal_to<int>, Moses2::MemPoolAllocator<int> > s(a);
111111
s.insert(3);
112112
s.insert(4);
113113
s.insert(3);

moses2/Phrase.h

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#pragma once
99

10+
#include <boost/functional/hash.hpp>
1011
#include <cstddef>
1112
#include <string>
1213
#include <sstream>

moses2/PhraseBased/CubePruningMiniStack/Misc.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#pragma once
88
#include <boost/pool/pool_alloc.hpp>
99
#include <boost/unordered_map.hpp>
10-
#include <boost/unordered_set.hpp>
10+
#include <unordered_set>
1111
#include <vector>
1212
#include <queue>
1313
#include "../../legacy/Range.h"
@@ -70,7 +70,7 @@ class CubeEdge
7070
std::vector<QueueItem*, MemPoolAllocator<QueueItem*> >, QueueItemOrderer> Queue;
7171

7272
typedef std::pair<const CubeEdge*, int> SeenPositionItem;
73-
typedef boost::unordered_set<SeenPositionItem, boost::hash<SeenPositionItem>,
73+
typedef std::unordered_set<SeenPositionItem, boost::hash<SeenPositionItem>,
7474
std::equal_to<SeenPositionItem>, MemPoolAllocator<SeenPositionItem> > SeenPositions;
7575

7676
const Hypotheses &hypos;

moses2/PhraseBased/CubePruningMiniStack/Search.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void Search::Decode(size_t stackInd)
110110

111111
/*
112112
cerr << "edges: ";
113-
boost::unordered_set<const Bitmap*> uniqueBM;
113+
std::unordered_set<const Bitmap*> uniqueBM;
114114
BOOST_FOREACH(CubeEdge *edge, edges) {
115115
uniqueBM.insert(&edge->newBitmap);
116116
//cerr << *edge << " ";

moses2/PhraseBased/CubePruningMiniStack/Stack.h

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77
#pragma once
88
#include <boost/unordered_map.hpp>
9-
#include <boost/unordered_set.hpp>
109
#include <deque>
1110
#include "../Hypothesis.h"
1211
#include "../../TypeDef.h"

moses2/PhraseBased/Manager.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
#include <boost/foreach.hpp>
88
#include <boost/functional/hash.hpp>
9-
#include <boost/unordered_set.hpp>
9+
#include <unordered_set>
1010
#include <vector>
1111
#include <sstream>
1212
#include "Manager.h"
@@ -218,7 +218,7 @@ std::string Manager::OutputNBest()
218218
{
219219
arcLists.Sort();
220220

221-
boost::unordered_set<size_t> distinctHypos;
221+
std::unordered_set<size_t> distinctHypos;
222222

223223
TrellisPaths<TrellisPath> contenders;
224224
m_search->AddInitialTrellisPaths(contenders);

moses2/PhraseBased/Normal/Stack.h

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77
#pragma once
88

9-
#include <boost/unordered_set.hpp>
109
#include <deque>
1110
#include "../Hypothesis.h"
1211
#include "../../TypeDef.h"

moses2/SCFG/Misc.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#pragma once
88
#include <vector>
99
#include <queue>
10-
#include <boost/unordered_set.hpp>
10+
#include <unordered_set>
1111
#include "../HypothesisColl.h"
1212
#include "../Vector.h"
1313
#include "Hypothesis.h"
@@ -60,7 +60,7 @@ class SeenPositions
6060

6161

6262
protected:
63-
typedef boost::unordered_set<const SeenPosition*,
63+
typedef std::unordered_set<const SeenPosition*,
6464
UnorderedComparer<SeenPosition>, UnorderedComparer<SeenPosition> > Coll;
6565
Coll m_coll;
6666
};

moses2/SCFG/nbest/NBests.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
#pragma once
9-
#include <boost/unordered_set.hpp>
9+
#include <unordered_set>
1010
#include "NBest.h"
1111

1212
namespace Moses2
@@ -18,7 +18,7 @@ class NBests
1818
{
1919
public:
2020
Contenders contenders;
21-
boost::unordered_set<size_t> distinctHypos;
21+
std::unordered_set<size_t> distinctHypos;
2222

2323
NBests(const SCFG::Manager &mgr,
2424
const ArcList &arcList,

moses2/defer/CubePruningBitmapStack/Misc.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#pragma once
88
#include <boost/pool/pool_alloc.hpp>
99
#include <boost/unordered_map.hpp>
10-
#include <boost/unordered_set.hpp>
1110
#include <vector>
1211
#include <queue>
1312
#include "../../legacy/Range.h"
@@ -72,7 +71,7 @@ class CubeEdge
7271
QueueItemOrderer> Queue;
7372

7473
typedef std::pair<const CubeEdge*, int> SeenPositionItem;
75-
typedef boost::unordered_set<SeenPositionItem,
74+
typedef std::unordered_set<SeenPositionItem,
7675
boost::hash<SeenPositionItem>,
7776
std::equal_to<SeenPositionItem> > SeenPositions;
7877

moses2/defer/CubePruningBitmapStack/Search.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void Search::Decode(size_t stackInd)
9696

9797
/*
9898
cerr << "edges: ";
99-
boost::unordered_set<const Bitmap*> uniqueBM;
99+
std::unordered_set<const Bitmap*> uniqueBM;
100100
BOOST_FOREACH(CubeEdge *edge, edges) {
101101
uniqueBM.insert(&edge->newBitmap);
102102
//cerr << *edge << " ";

moses2/defer/CubePruningBitmapStack/Stack.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77
#pragma once
88
#include <boost/unordered_map.hpp>
9-
#include <boost/unordered_set.hpp>
109
#include <deque>
1110
#include "../Hypothesis.h"
1211
#include "../../TypeDef.h"
@@ -27,7 +26,7 @@ typedef Vector<const Hypothesis*> Hypotheses;
2726
class MiniStack
2827
{
2928
public:
30-
typedef boost::unordered_set<const Hypothesis*,
29+
typedef std::unordered_set<const Hypothesis*,
3130
UnorderedComparer<Hypothesis>,
3231
UnorderedComparer<Hypothesis>
3332
> _HCType;

moses2/defer/CubePruningCardinalStack/Misc.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#pragma once
88
#include <boost/pool/pool_alloc.hpp>
99
#include <boost/unordered_map.hpp>
10-
#include <boost/unordered_set.hpp>
1110
#include <vector>
1211
#include <queue>
1312
#include "../../legacy/Range.h"
@@ -72,7 +71,7 @@ class CubeEdge
7271
QueueItemOrderer> Queue;
7372

7473
typedef std::pair<const CubeEdge*, int> SeenPositionItem;
75-
typedef boost::unordered_set<SeenPositionItem,
74+
typedef std::unordered_set<SeenPositionItem,
7675
boost::hash<SeenPositionItem>,
7776
std::equal_to<SeenPositionItem>
7877
> SeenPositions;

moses2/defer/CubePruningCardinalStack/Search.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void Search::Decode(size_t stackInd)
9696

9797
/*
9898
cerr << "edges: ";
99-
boost::unordered_set<const Bitmap*> uniqueBM;
99+
std::unordered_set<const Bitmap*> uniqueBM;
100100
BOOST_FOREACH(CubeEdge *edge, edges) {
101101
uniqueBM.insert(&edge->newBitmap);
102102
//cerr << *edge << " ";

moses2/defer/CubePruningCardinalStack/Stack.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77
#pragma once
88
#include <boost/unordered_map.hpp>
9-
#include <boost/unordered_set.hpp>
109
#include <deque>
1110
#include "../Hypothesis.h"
1211
#include "../../TypeDef.h"
@@ -29,7 +28,7 @@ typedef Vector<const Hypothesis*> Hypotheses;
2928
class Stack
3029
{
3130
protected:
32-
typedef boost::unordered_set<const Hypothesis*,
31+
typedef std::unordered_set<const Hypothesis*,
3332
UnorderedComparer<Hypothesis>,
3433
UnorderedComparer<Hypothesis>
3534
> _HCType;

moses2/defer/CubePruningPerBitmap/Misc.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#pragma once
88
#include <boost/pool/pool_alloc.hpp>
99
#include <boost/unordered_map.hpp>
10-
#include <boost/unordered_set.hpp>
1110
#include <vector>
1211
#include <queue>
1312
#include "../../legacy/Range.h"
@@ -72,7 +71,7 @@ class CubeEdge
7271
QueueItemOrderer> Queue;
7372

7473
typedef std::pair<const CubeEdge*, int> SeenPositionItem;
75-
typedef boost::unordered_set<SeenPositionItem,
74+
typedef std::unordered_set<SeenPositionItem,
7675
boost::hash<SeenPositionItem>,
7776
std::equal_to<SeenPositionItem>
7877
> SeenPositions;

moses2/defer/CubePruningPerMiniStack/Misc.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#pragma once
88
#include <boost/pool/pool_alloc.hpp>
99
#include <boost/unordered_map.hpp>
10-
#include <boost/unordered_set.hpp>
1110
#include <vector>
1211
#include <queue>
1312
#include "../../legacy/Range.h"
@@ -72,7 +71,7 @@ class CubeEdge
7271
QueueItemOrderer> Queue;
7372

7473
typedef std::pair<const CubeEdge*, int> SeenPositionItem;
75-
typedef boost::unordered_set<SeenPositionItem,
74+
typedef std::unordered_set<SeenPositionItem,
7675
boost::hash<SeenPositionItem>,
7776
std::equal_to<SeenPositionItem>
7877
> SeenPositions;

moses2/legacy/Bitmaps.h

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
22

3-
#include <boost/unordered_set.hpp>
43
#include <boost/unordered_map.hpp>
54
#include <set>
65
#include <stack>

moses2/legacy/FactorCollection.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#endif
3232

3333
#include "util/murmur_hash.hh"
34-
#include <boost/unordered_set.hpp>
34+
#include <unordered_set>
3535

3636
#include <functional>
3737
#include <string>
@@ -82,7 +82,7 @@ class FactorCollection
8282
return left.in.GetString() == right.in.GetString();
8383
}
8484
};
85-
typedef boost::unordered_set<FactorFriend, HashFactor, EqualsFactor> Set;
85+
typedef std::unordered_set<FactorFriend, HashFactor, EqualsFactor> Set;
8686
Set m_set;
8787
Set m_setNonTerminal;
8888

0 commit comments

Comments
 (0)