Skip to content

Commit

Permalink
use std::unordered_set instead of boost::unordered_set for all instan…
Browse files Browse the repository at this point in the history
…ces in moses2. To avoid confusion
  • Loading branch information
hieuhoang committed Sep 26, 2017
1 parent d3c2c0b commit 65c75ff
Show file tree
Hide file tree
Showing 22 changed files with 23 additions and 36 deletions.
4 changes: 1 addition & 3 deletions moses2/FF/StatefulFeatureFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* Author: hieu
*/

#ifndef STATEFULFEATUREFUNCTION_H_
#define STATEFULFEATUREFUNCTION_H_
#pragma once

#include "FeatureFunction.h"
#include "FFState.h"
Expand Down Expand Up @@ -63,4 +62,3 @@ class StatefulFeatureFunction: public FeatureFunction

}

#endif /* STATEFULFEATUREFUNCTION_H_ */
4 changes: 1 addition & 3 deletions moses2/FF/StatelessFeatureFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* Author: hieu
*/

#ifndef STATELESSFEATUREFUNCTION_H_
#define STATELESSFEATUREFUNCTION_H_
#pragma once

#include "FeatureFunction.h"

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

}

#endif /* STATELESSFEATUREFUNCTION_H_ */
1 change: 0 additions & 1 deletion moses2/HypothesisColl.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
#pragma once
#include <unordered_set>
#include <boost/unordered_set.hpp>
#include "HypothesisBase.h"
#include "MemPoolAllocator.h"
#include "Recycler.h"
Expand Down
2 changes: 1 addition & 1 deletion moses2/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void Temp()
Moses2::MemPool pool;
Moses2::MemPoolAllocator<int> a(pool);

boost::unordered_set<int, boost::hash<int>, std::equal_to<int>, Moses2::MemPoolAllocator<int> > s(a);
std::unordered_set<int, boost::hash<int>, std::equal_to<int>, Moses2::MemPoolAllocator<int> > s(a);
s.insert(3);
s.insert(4);
s.insert(3);
Expand Down
1 change: 1 addition & 0 deletions moses2/Phrase.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#pragma once

#include <boost/functional/hash.hpp>
#include <cstddef>
#include <string>
#include <sstream>
Expand Down
4 changes: 2 additions & 2 deletions moses2/PhraseBased/CubePruningMiniStack/Misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#pragma once
#include <boost/pool/pool_alloc.hpp>
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#include <unordered_set>
#include <vector>
#include <queue>
#include "../../legacy/Range.h"
Expand Down Expand Up @@ -70,7 +70,7 @@ class CubeEdge
std::vector<QueueItem*, MemPoolAllocator<QueueItem*> >, QueueItemOrderer> Queue;

typedef std::pair<const CubeEdge*, int> SeenPositionItem;
typedef boost::unordered_set<SeenPositionItem, boost::hash<SeenPositionItem>,
typedef std::unordered_set<SeenPositionItem, boost::hash<SeenPositionItem>,
std::equal_to<SeenPositionItem>, MemPoolAllocator<SeenPositionItem> > SeenPositions;

const Hypotheses &hypos;
Expand Down
2 changes: 1 addition & 1 deletion moses2/PhraseBased/CubePruningMiniStack/Search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void Search::Decode(size_t stackInd)

/*
cerr << "edges: ";
boost::unordered_set<const Bitmap*> uniqueBM;
std::unordered_set<const Bitmap*> uniqueBM;
BOOST_FOREACH(CubeEdge *edge, edges) {
uniqueBM.insert(&edge->newBitmap);
//cerr << *edge << " ";
Expand Down
1 change: 0 additions & 1 deletion moses2/PhraseBased/CubePruningMiniStack/Stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
#pragma once
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#include <deque>
#include "../Hypothesis.h"
#include "../../TypeDef.h"
Expand Down
4 changes: 2 additions & 2 deletions moses2/PhraseBased/Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
#include <boost/foreach.hpp>
#include <boost/functional/hash.hpp>
#include <boost/unordered_set.hpp>
#include <unordered_set>
#include <vector>
#include <sstream>
#include "Manager.h"
Expand Down Expand Up @@ -218,7 +218,7 @@ std::string Manager::OutputNBest()
{
arcLists.Sort();

boost::unordered_set<size_t> distinctHypos;
std::unordered_set<size_t> distinctHypos;

TrellisPaths<TrellisPath> contenders;
m_search->AddInitialTrellisPaths(contenders);
Expand Down
1 change: 0 additions & 1 deletion moses2/PhraseBased/Normal/Stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
#pragma once

#include <boost/unordered_set.hpp>
#include <deque>
#include "../Hypothesis.h"
#include "../../TypeDef.h"
Expand Down
4 changes: 2 additions & 2 deletions moses2/SCFG/Misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#pragma once
#include <vector>
#include <queue>
#include <boost/unordered_set.hpp>
#include <unordered_set>
#include "../HypothesisColl.h"
#include "../Vector.h"
#include "Hypothesis.h"
Expand Down Expand Up @@ -60,7 +60,7 @@ class SeenPositions


protected:
typedef boost::unordered_set<const SeenPosition*,
typedef std::unordered_set<const SeenPosition*,
UnorderedComparer<SeenPosition>, UnorderedComparer<SeenPosition> > Coll;
Coll m_coll;
};
Expand Down
4 changes: 2 additions & 2 deletions moses2/SCFG/nbest/NBests.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#pragma once
#include <boost/unordered_set.hpp>
#include <unordered_set>
#include "NBest.h"

namespace Moses2
Expand All @@ -18,7 +18,7 @@ class NBests
{
public:
Contenders contenders;
boost::unordered_set<size_t> distinctHypos;
std::unordered_set<size_t> distinctHypos;

NBests(const SCFG::Manager &mgr,
const ArcList &arcList,
Expand Down
3 changes: 1 addition & 2 deletions moses2/defer/CubePruningBitmapStack/Misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#pragma once
#include <boost/pool/pool_alloc.hpp>
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#include <vector>
#include <queue>
#include "../../legacy/Range.h"
Expand Down Expand Up @@ -72,7 +71,7 @@ class CubeEdge
QueueItemOrderer> Queue;

typedef std::pair<const CubeEdge*, int> SeenPositionItem;
typedef boost::unordered_set<SeenPositionItem,
typedef std::unordered_set<SeenPositionItem,
boost::hash<SeenPositionItem>,
std::equal_to<SeenPositionItem> > SeenPositions;

Expand Down
2 changes: 1 addition & 1 deletion moses2/defer/CubePruningBitmapStack/Search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void Search::Decode(size_t stackInd)

/*
cerr << "edges: ";
boost::unordered_set<const Bitmap*> uniqueBM;
std::unordered_set<const Bitmap*> uniqueBM;
BOOST_FOREACH(CubeEdge *edge, edges) {
uniqueBM.insert(&edge->newBitmap);
//cerr << *edge << " ";
Expand Down
3 changes: 1 addition & 2 deletions moses2/defer/CubePruningBitmapStack/Stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
#pragma once
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#include <deque>
#include "../Hypothesis.h"
#include "../../TypeDef.h"
Expand All @@ -27,7 +26,7 @@ typedef Vector<const Hypothesis*> Hypotheses;
class MiniStack
{
public:
typedef boost::unordered_set<const Hypothesis*,
typedef std::unordered_set<const Hypothesis*,
UnorderedComparer<Hypothesis>,
UnorderedComparer<Hypothesis>
> _HCType;
Expand Down
3 changes: 1 addition & 2 deletions moses2/defer/CubePruningCardinalStack/Misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#pragma once
#include <boost/pool/pool_alloc.hpp>
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#include <vector>
#include <queue>
#include "../../legacy/Range.h"
Expand Down Expand Up @@ -72,7 +71,7 @@ class CubeEdge
QueueItemOrderer> Queue;

typedef std::pair<const CubeEdge*, int> SeenPositionItem;
typedef boost::unordered_set<SeenPositionItem,
typedef std::unordered_set<SeenPositionItem,
boost::hash<SeenPositionItem>,
std::equal_to<SeenPositionItem>
> SeenPositions;
Expand Down
2 changes: 1 addition & 1 deletion moses2/defer/CubePruningCardinalStack/Search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void Search::Decode(size_t stackInd)

/*
cerr << "edges: ";
boost::unordered_set<const Bitmap*> uniqueBM;
std::unordered_set<const Bitmap*> uniqueBM;
BOOST_FOREACH(CubeEdge *edge, edges) {
uniqueBM.insert(&edge->newBitmap);
//cerr << *edge << " ";
Expand Down
3 changes: 1 addition & 2 deletions moses2/defer/CubePruningCardinalStack/Stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
#pragma once
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#include <deque>
#include "../Hypothesis.h"
#include "../../TypeDef.h"
Expand All @@ -29,7 +28,7 @@ typedef Vector<const Hypothesis*> Hypotheses;
class Stack
{
protected:
typedef boost::unordered_set<const Hypothesis*,
typedef std::unordered_set<const Hypothesis*,
UnorderedComparer<Hypothesis>,
UnorderedComparer<Hypothesis>
> _HCType;
Expand Down
3 changes: 1 addition & 2 deletions moses2/defer/CubePruningPerBitmap/Misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#pragma once
#include <boost/pool/pool_alloc.hpp>
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#include <vector>
#include <queue>
#include "../../legacy/Range.h"
Expand Down Expand Up @@ -72,7 +71,7 @@ class CubeEdge
QueueItemOrderer> Queue;

typedef std::pair<const CubeEdge*, int> SeenPositionItem;
typedef boost::unordered_set<SeenPositionItem,
typedef std::unordered_set<SeenPositionItem,
boost::hash<SeenPositionItem>,
std::equal_to<SeenPositionItem>
> SeenPositions;
Expand Down
3 changes: 1 addition & 2 deletions moses2/defer/CubePruningPerMiniStack/Misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#pragma once
#include <boost/pool/pool_alloc.hpp>
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#include <vector>
#include <queue>
#include "../../legacy/Range.h"
Expand Down Expand Up @@ -72,7 +71,7 @@ class CubeEdge
QueueItemOrderer> Queue;

typedef std::pair<const CubeEdge*, int> SeenPositionItem;
typedef boost::unordered_set<SeenPositionItem,
typedef std::unordered_set<SeenPositionItem,
boost::hash<SeenPositionItem>,
std::equal_to<SeenPositionItem>
> SeenPositions;
Expand Down
1 change: 0 additions & 1 deletion moses2/legacy/Bitmaps.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include <boost/unordered_set.hpp>
#include <boost/unordered_map.hpp>
#include <set>
#include <stack>
Expand Down
4 changes: 2 additions & 2 deletions moses2/legacy/FactorCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#endif

#include "util/murmur_hash.hh"
#include <boost/unordered_set.hpp>
#include <unordered_set>

#include <functional>
#include <string>
Expand Down Expand Up @@ -82,7 +82,7 @@ class FactorCollection
return left.in.GetString() == right.in.GetString();
}
};
typedef boost::unordered_set<FactorFriend, HashFactor, EqualsFactor> Set;
typedef std::unordered_set<FactorFriend, HashFactor, EqualsFactor> Set;
Set m_set;
Set m_setNonTerminal;

Expand Down

0 comments on commit 65c75ff

Please sign in to comment.