From 6df4dbd4217b6d4e863876f98876075aeaf66f30 Mon Sep 17 00:00:00 2001 From: graehl Date: Fri, 27 Aug 2010 23:52:20 +0000 Subject: still compiles git-svn-id: https://ws10smt.googlecode.com/svn/trunk@627 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/cfg.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'decoder/cfg.h') 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 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 void VisitRuleIds(V &v) { - for (int i=0,e=nts.size();i void VisitRuleIds(V const& v) { for (int i=0,e=nts.size();i