summaryrefslogtreecommitdiff
path: root/decoder/cfg.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-27 23:52:20 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-27 23:52:20 +0000
commit8ff664a63254c2e64dc296caffc3a0261e2473af (patch)
treeb8b3d8ab07b6fc5228ff3104bc2339efbbf99d70 /decoder/cfg.h
parent1eab70e16f0e0d5531f3babfea2062c82f6362e1 (diff)
still compiles
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@627 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/cfg.h')
-rwxr-xr-xdecoder/cfg.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/decoder/cfg.h b/decoder/cfg.h
index 79ae6f33..95cb5fd7 100755
--- a/decoder/cfg.h
+++ b/decoder/cfg.h
@@ -1,6 +1,8 @@
#ifndef CDEC_CFG_H
#define CDEC_CFG_H
+#define DVISITRULEID(x)
+
// for now, debug means remembering and printing the TRule behind each CFG rule
#ifndef CFG_DEBUG
# define CFG_DEBUG 1
@@ -133,6 +135,10 @@ struct CFG {
swap(f,o.f);
IF_CFG_TRULE(swap(rule,o.rule);)
}
+ friend inline void swap(Rule &a,Rule &b) {
+ a.Swap(b);
+ }
+
template<class V>
void visit_rhs_nts(V &v) const {
for (RHS::const_iterator i=rhs.begin(),e=rhs.end();i!=e;++i) {
@@ -195,6 +201,9 @@ struct CFG {
swap(ruleids,o.ruleids);
swap(from,o.from);
}
+ friend inline void swap(NT &a,NT &b) {
+ a.Swap(b);
+ }
};
CFG() : hg_() { uninit=true; }
@@ -294,14 +303,19 @@ struct CFG {
// call after rules are indexed.
template <class V>
void VisitRuleIds(V &v) {
- for (int i=0,e=nts.size();i<e;++i)
- for (Ruleids::const_iterator j=nts[i].ruleids.begin(),jj=nts[i].ruleids.begin();j!=jj;++j)
+ for (int i=0,e=nts.size();i<e;++i) {
+ SHOWM(DVISITRULEID,"VisitRuleIds nt",i);
+ for (Ruleids::const_iterator j=nts[i].ruleids.begin(),jj=nts[i].ruleids.end();j!=jj;++j) {
+ SHOWM2(DVISITRULEID,"VisitRuleIds",i,*j);
v(*j);
+ }
+ }
+
}
template <class V>
void VisitRuleIds(V const& v) {
for (int i=0,e=nts.size();i<e;++i)
- for (Ruleids::const_iterator j=nts[i].ruleids.begin(),jj=nts[i].ruleids.begin();j!=jj;++j)
+ for (Ruleids::const_iterator j=nts[i].ruleids.begin(),jj=nts[i].ruleids.end();j!=jj;++j)
v(*j);
}
@@ -351,7 +365,6 @@ inline std::size_t hash_value(CFG::NT const& r) {
return r.hash_impl();
}
-
inline void swap(CFG &a,CFG &b) {
a.Swap(b);
}