diff options
author | graehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-16 09:17:46 +0000 |
---|---|---|
committer | graehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-16 09:17:46 +0000 |
commit | 2959b25bfd92e267702c9947c765a10c9e9d397f (patch) | |
tree | be226292d32f1bf30684be28c09acc8442352311 /decoder | |
parent | 6cc769d102bfcf87822ceeb499cf45ff1e79e5f6 (diff) |
fixed vector iter invalid. from push_back
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@561 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder')
-rwxr-xr-x | decoder/cfg.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/decoder/cfg.cc b/decoder/cfg.cc index 0fbb6a03..b0d4eab6 100755 --- a/decoder/cfg.cc +++ b/decoder/cfg.cc @@ -366,15 +366,16 @@ RHS null_for<RHS>::null(1,std::numeric_limits<int>::min()); void CFG::BinarizeSplit(CFGBinarize const& b) { add_virtual_rules<RHS> v(*this,b.bin_name_nts); CFG_FOR_RULES(i,v.split_rhs(rules[i].rhs,false,false)); + Rules &newr=v.new_rules; #undef CFG_FOR_VIRT #define CFG_FOR_VIRT(r,expr) \ - for (Rules::iterator ri=v.new_rules.begin(),e=v.new_rules.end();ri!=e;++ri) { \ - Rule &r=*ri;expr; } + for (int i=0,e=newr.size();i<e;++i) { \ + Rule &r=newr[i];expr; } // NOTE: must use indices since we'll be adding rules as we iterate. int n_changed_total=0; #define CFG_SPLIT_PASS(N,free,just1) \ - for (int i=0;i<b.N;++i) { \ + for (int pass=0;pass<b.N;++pass) { \ int n_changed=0; \ CFG_FOR_VIRT(r,n_changed+=v.split_rhs(r.rhs,free,just1)); \ if (!n_changed) { \ |