diff options
author | hieu <hieu@localhost.localdomain> | 2015-07-01 08:42:07 +0300 |
---|---|---|
committer | hieu <hieu@localhost.localdomain> | 2015-07-01 08:42:07 +0300 |
commit | 81f337bcd838a69bf0e275c8138b173427a17d02 (patch) | |
tree | e578c2570862c96c54ffbdca104bff07e8eac46c | |
parent | a374706bd4a995aa810b748f122b2d6279866088 (diff) |
rollback c++11 for now
-rw-r--r-- | Jamroot | 2 | ||||
-rw-r--r-- | moses/StaticData.cpp | 3 | ||||
-rw-r--r-- | phrase-extract/ScoreFeatureTest.cpp | 33 |
3 files changed, 21 insertions, 17 deletions
@@ -108,7 +108,7 @@ external-lib z ; #lib dl : : <runtime-link>static:<link>static <runtime-link>shared:<link>shared ; #requirements += <library>dl ; -requirements += <cxxflags>-std=c++0x ; +#requirements += <cxxflags>-std=c++0x ; if ! [ option.get "without-tcmalloc" : : "yes" ] && [ test_library "tcmalloc_minimal" ] { if [ option.get "full-tcmalloc" : : "yes" ] { diff --git a/moses/StaticData.cpp b/moses/StaticData.cpp index 28d9f7831..281129a2e 100644 --- a/moses/StaticData.cpp +++ b/moses/StaticData.cpp @@ -1115,7 +1115,8 @@ void StaticData::LoadSparseWeightsFromConfig() } std::map<std::string, std::vector<float> > weights = m_parameter->GetAllWeights(); - for (auto iter = weights.begin(); iter != weights.end(); ++iter) { + std::map<std::string, std::vector<float> >::iterator iter; + for (iter = weights.begin(); iter != weights.end(); ++iter) { // this indicates that it is sparse feature if (featureNames.find(iter->first) == featureNames.end()) { UTIL_THROW_IF2(iter->second.size() != 1, "ERROR: only one weight per sparse feature allowed: " << iter->first); diff --git a/phrase-extract/ScoreFeatureTest.cpp b/phrase-extract/ScoreFeatureTest.cpp index 94a5a0480..9537b970f 100644 --- a/phrase-extract/ScoreFeatureTest.cpp +++ b/phrase-extract/ScoreFeatureTest.cpp @@ -24,9 +24,10 @@ #define BOOST_TEST_MODULE MosesTrainingScoreFeature #include <boost/test/test_tools.hpp> #include <boost/test/unit_test.hpp> +#include <boost/assign/list_of.hpp> -#include <unordered_set> -#include <unordered_map> +//#include <unordered_set> +//#include <unordered_map> using namespace MosesTraining; using namespace std; @@ -54,16 +55,16 @@ BOOST_AUTO_TEST_CASE(manager_configure_domain_except) //Check that configure rejects illegal domain arg combinations ScoreFeatureManager manager; BOOST_CHECK_THROW( - manager.configure( {"--DomainRatio","/dev/null","--DomainIndicator","/dev/null"}), + manager.configure(boost::assign::list_of("--DomainRatio")("/dev/null")("--DomainIndicator")("/dev/null")), ScoreFeatureArgumentException); BOOST_CHECK_THROW( - manager.configure( {"--SparseDomainSubset","/dev/null","--SparseDomainRatio","/dev/null"}), + manager.configure(boost::assign::list_of("--SparseDomainSubset")("/dev/null")("--SparseDomainRatio")("/dev/null")), ScoreFeatureArgumentException); BOOST_CHECK_THROW( - manager.configure( {"--SparseDomainBlah","/dev/null"}), + manager.configure(boost::assign::list_of("--SparseDomainBlah")("/dev/null")), ScoreFeatureArgumentException); BOOST_CHECK_THROW( - manager.configure( {"--DomainSubset"}), + manager.configure(boost::assign::list_of("--DomainSubset")), ScoreFeatureArgumentException); } @@ -97,25 +98,27 @@ T adder(T first, Args... args) BOOST_AUTO_TEST_CASE(manager_config_domain) { checkDomainConfigured<RatioDomainFeature> - ( {"--DomainRatio","/dev/null"}); + (boost::assign::list_of("--DomainRatio")("/dev/null")); checkDomainConfigured<IndicatorDomainFeature> - ( {"--DomainIndicator","/dev/null"}); + (boost::assign::list_of("--DomainIndicator")("/dev/null")); checkDomainConfigured<SubsetDomainFeature> - ( {"--DomainSubset","/dev/null"}); + (boost::assign::list_of("--DomainSubset")("/dev/null")); checkDomainConfigured<SparseRatioDomainFeature> - ( {"--SparseDomainRatio","/dev/null"}); + (boost::assign::list_of("--SparseDomainRatio")("/dev/null")); checkDomainConfigured<SparseIndicatorDomainFeature> - ( {"--SparseDomainIndicator","/dev/null"}); + (boost::assign::list_of("--SparseDomainIndicator")("/dev/null")); checkDomainConfigured<SparseSubsetDomainFeature> - ( {"--SparseDomainSubset","/dev/null"}); + (boost::assign::list_of("--SparseDomainSubset")("/dev/null")); + /* + // C++11 testing unordered_set<int> s; s.insert(4); s.insert(7); s.insert(4); s.insert(1); -for (auto i: s) { + for (auto i: s) { cerr << i << " "; } @@ -124,7 +127,7 @@ for (auto i: s) { m["ba"] = 6; m["aabc"] = 7; -for (auto i: m) { + for (auto i: m) { cerr << i.first << "=" << i.second << " "; } @@ -132,6 +135,6 @@ for (auto i: m) { std::string s1 = "x", s2 = "aa", s3 = "bb", s4 = "yy"; std::string ssum = adder(s1, s2, s3, s4); - + */ } |