avoid boost

This commit is contained in:
Hieu Hoang 2024-02-21 16:06:21 -08:00
parent b36637ffb3
commit a056e26a5f
6 changed files with 15 additions and 7 deletions

5
moses2/ArcLists.h Normal file → Executable file
View File

@ -6,7 +6,8 @@
*/ */
#pragma once #pragma once
#include <vector> #include <vector>
#include <boost/unordered_map.hpp> #include <unordered_map>
#include <unordered_set>
namespace Moses2 namespace Moses2
{ {
@ -31,7 +32,7 @@ public:
std::string Debug(const System &system) const; std::string Debug(const System &system) const;
protected: protected:
typedef boost::unordered_map<const HypothesisBase*, ArcList*> Coll; typedef std::unordered_map<const HypothesisBase*, ArcList*> Coll;
Coll m_coll; Coll m_coll;
ArcList &GetArcList(const HypothesisBase *hypo); ArcList &GetArcList(const HypothesisBase *hypo);

View File

@ -16,6 +16,7 @@
#include "TypeDef.h" #include "TypeDef.h"
#include "legacy/FactorCollection.h" #include "legacy/FactorCollection.h"
#include "SCFG/Word.h" #include "SCFG/Word.h"
#include <boost/functional/hash.hpp>
namespace Moses2 namespace Moses2
{ {

7
moses2/SCFG/Misc.cpp Normal file → Executable file
View File

@ -83,7 +83,12 @@ size_t SeenPosition::hash() const
size_t ret = (size_t) &symbolBind; size_t ret = (size_t) &symbolBind;
boost::hash_combine(ret, &tps); boost::hash_combine(ret, &tps);
boost::hash_combine(ret, tpInd); boost::hash_combine(ret, tpInd);
boost::hash_combine(ret, hypoIndColl);
for (size_t i = 0; i < hypoIndColl.size(); ++i) {
size_t val = hypoIndColl[i];
boost::hash_combine(ret, val);
}
return ret; return ret;
} }

4
moses2/SCFG/Misc.h Normal file → Executable file
View File

@ -7,7 +7,7 @@
#pragma once #pragma once
#include <vector> #include <vector>
#include <queue> #include <queue>
#include <boost/unordered_set.hpp> #include <unordered_set>
#include "../HypothesisColl.h" #include "../HypothesisColl.h"
#include "../Vector.h" #include "../Vector.h"
#include "Hypothesis.h" #include "Hypothesis.h"
@ -60,7 +60,7 @@ public:
protected: protected:
typedef boost::unordered_set<const SeenPosition*, typedef std::unordered_set<const SeenPosition*,
UnorderedComparer<SeenPosition>, UnorderedComparer<SeenPosition> > Coll; UnorderedComparer<SeenPosition>, UnorderedComparer<SeenPosition> > Coll;
Coll m_coll; Coll m_coll;
}; };

1
moses2/legacy/Bitmaps.h Normal file → Executable file
View File

@ -6,6 +6,7 @@
#include <stack> #include <stack>
#include "Bitmap.h" #include "Bitmap.h"
#include "Util2.h" #include "Util2.h"
#include <unordered_set>
namespace Moses2 namespace Moses2
{ {

4
moses2/legacy/FactorCollection.h Normal file → Executable file
View File

@ -31,7 +31,7 @@
#endif #endif
#include "util/murmur_hash.hh" #include "util/murmur_hash.hh"
#include <boost/unordered_set.hpp> #include <unordered_set>
#include <functional> #include <functional>
#include <string> #include <string>
@ -82,7 +82,7 @@ class FactorCollection
return left.in.GetString() == right.in.GetString(); 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_set;
Set m_setNonTerminal; Set m_setNonTerminal;