]> www.ginac.de Git - ginac.git/blobdiff - ginac/container.h
[nitpick] power::expand_add(): don't use int instead of std::size_t.
[ginac.git] / ginac / container.h
index b173e35d476ca1fa3f4f9c01f8801e6f8a3bd654..bd21eb91291402c69d90075e1b780db116fb0e9f 100644 (file)
@@ -3,7 +3,7 @@
  *  Wrapper template for making GiNaC classes out of STL containers. */
 
 /*
- *  GiNaC Copyright (C) 1999-2006 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -487,12 +487,14 @@ container<C>::container(const archive_node &n, lst &sym_lst) : inherited(n, sym_
 {
        setflag(get_default_flags());
 
-       for (unsigned int i=0; true; i++) {
+       archive_node::archive_node_cit first = n.find_first("seq");
+       archive_node::archive_node_cit last = n.find_last("seq");
+       ++last;
+       reserve(this->seq, last - first);
+       for (archive_node::archive_node_cit i=first; i<last; ++i) {
                ex e;
-               if (n.find_ex("seq", e, sym_lst, i))
-                       this->seq.push_back(e);
-               else
-                       break;
+               n.find_ex_by_loc(i, e, sym_lst);
+               this->seq.push_back(e);
        }
 }