Changeset 3918 for toimperative
 Timestamp:
 Sep 16, 2008, 4:36:48 PM (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

toimperative/trunk/opents/samples/trefal.hh
r3917 r3918 63 63 struct GExpr { 64 64 Term* terms; 65 size_t terms_size;66 65 size_t size; 67 66 bool need_delete; 68 67 69 GExpr () : terms(0), terms_size(0),size(0), need_delete(false) {}68 GExpr () : terms(0), size(0), need_delete(false) {} 70 69 71 70 inline GExpr (TExpr& _e); 72 71 73 GExpr (int size) : terms(new Term[size]), terms_size(size),size(0), need_delete(true) {}72 GExpr (int size) : terms(new Term[size]), size(0), need_delete(true) {} 74 73 75 74 GExpr& operator= (GExpr& e) { … … 88 87 89 88 GExpr& add (const Term& t) { 90 if (size == terms_size) {91 Term* new_terms_array = new Term[2*size];92 Term* old_terms = terms;93 Term* new_terms = new_terms_array;94 for (size_t i = 0; i < size; i++)95 *new_terms++ = *old_terms++;96 delete[] terms;97 terms = new_terms_array;98 terms_size = 2*size;99 }100 89 terms[size++] = t; 101 90 return *this; … … 403 392 // =================================== GExpr =================================== 404 393 405 inline GExpr::GExpr (TExpr& _e) : terms((Expr&)_e), terms_size(0),size(((Expr&)_e).get_len()), need_delete(false) {}394 inline GExpr::GExpr (TExpr& _e) : terms((Expr&)_e), size(((Expr&)_e).get_len()), need_delete(false) {} 406 395 407 396 GExpr& GExpr::add (GExpr& e) {
Note: See TracChangeset
for help on using the changeset viewer.