From 02184018ff661833dd7b10b463e5cb1ac2b6e98c Mon Sep 17 00:00:00 2001
From: Chris Dyer <redpony@gmail.com>
Date: Fri, 13 Jun 2014 00:23:19 -0400
Subject: tree fragment accepts StringPiece instead of string

---
 decoder/tree_fragment.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'decoder/tree_fragment.h')

diff --git a/decoder/tree_fragment.h b/decoder/tree_fragment.h
index 79722b5a..8bb7251a 100644
--- a/decoder/tree_fragment.h
+++ b/decoder/tree_fragment.h
@@ -8,6 +8,8 @@
 #include <cassert>
 #include <cstddef>
 
+#include "string_piece.hh"
+
 namespace cdec {
 
 class BreadthFirstIterator;
@@ -52,7 +54,7 @@ class TreeFragment {
  public:
   TreeFragment() : frontier_sites(), terminals() {}
   // (S (NP a (X b) c d) (VP (V foo) (NP (NN bar))))
-  explicit TreeFragment(const std::string& tree, bool allow_frontier_sites = false);
+  explicit TreeFragment(const StringPiece& tree, bool allow_frontier_sites = false);
   void DebugRec(unsigned cur, std::ostream* out) const;
   typedef DepthFirstIterator iterator;
   typedef ptrdiff_t difference_type;
@@ -73,7 +75,7 @@ class TreeFragment {
   // cp is the character index in the tree
   // np keeps track of the nodes (nonterminals) that have been built
   // symp keeps track of the terminal symbols that have been built
-  void ParseRec(const std::string& tree, bool afs, unsigned cp, unsigned symp, unsigned np, unsigned* pcp, unsigned* psymp, unsigned* pnp);
+  void ParseRec(const StringPiece& tree, bool afs, unsigned cp, unsigned symp, unsigned np, unsigned* pcp, unsigned* psymp, unsigned* pnp);
  public:
   unsigned root;
   unsigned char frontier_sites;
-- 
cgit v1.2.3