]> www.ginac.de Git - ginac.git/blobdiff - ginac/container.h
build: accept both python 3 and python 2
[ginac.git] / ginac / container.h
index a0a6dbf2f9c9ba03def8cfa532205fbc45314537..6909b743c60e6f826360ed573ed9bfd754de2efd 100644 (file)
@@ -3,7 +3,7 @@
  *  Wrapper template for making GiNaC classes out of STL containers. */
 
 /*
- *  GiNaC Copyright (C) 1999-2016 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2020 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
@@ -212,14 +212,12 @@ public:
                inherited::read_archive(n, sym_lst);
                setflag(get_default_flags());
 
-               archive_node::archive_node_cit first = n.find_first("seq");
-               archive_node::archive_node_cit last = n.find_last("seq");
-               ++last;
-               this->reserve(this->seq, last - first);
-               for (archive_node::archive_node_cit i=first; i<last; ++i) {
+               auto range =  n.find_property_range("seq", "seq");
+               this->reserve(this->seq, range.end - range.begin);
+               for (archive_node::archive_node_cit i=range.begin; i<range.end; ++i) {
                        ex e;
                        n.find_ex_by_loc(i, e, sym_lst);
-                       this->seq.push_back(e);
+                       this->seq.emplace_back(e);
                }
        }