]> www.ginac.de Git - ginac.git/blobdiff - ginac/ex.cpp
Use C++11 range-based foor loops and auto, where possible.
[ginac.git] / ginac / ex.cpp
index 7becb3e172da764458a6a28251c1526e8beec511..290154b4838e863859db143e181ea337e8ef9e75 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's light-weight expression handles. */
 
 /*
- *  GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2015 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
@@ -20,9 +20,6 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <iostream>
-#include <stdexcept>
-
 #include "ex.h"
 #include "add.h"
 #include "mul.h"
 #include "power.h"
 #include "lst.h"
 #include "relational.h"
-#include "input_lexer.h"
 #include "utils.h"
 
+#include <iostream>
+#include <stdexcept>
+
 namespace GiNaC {
 
 //////////
@@ -163,8 +162,7 @@ ex ex::subs(const ex & e, unsigned options) const
                // Argument is a list: convert it to a map
                exmap m;
                GINAC_ASSERT(is_a<lst>(e));
-               for (lst::const_iterator it = ex_to<lst>(e).begin(); it != ex_to<lst>(e).end(); ++it) {
-                       ex r = *it;
+               for (auto & r : ex_to<lst>(e)) {
                        if (!r.info(info_flags::relation_equal))
                                throw(std::invalid_argument("basic::subs(ex): argument must be a list of equations"));
                        const ex & s = r.op(0);
@@ -204,7 +202,7 @@ void ex::traverse_postorder(visitor & v) const
        accept(v);
 }
 
-/** Return modifyable operand/member at position i. */
+/** Return modifiable operand/member at position i. */
 ex & ex::let_op(size_t i)
 {
        makewriteable();
@@ -244,8 +242,8 @@ bool ex::is_polynomial(const ex & vars) const
 {
        if (is_a<lst>(vars)) {
                const lst & varlst = ex_to<lst>(vars);
-               for (lst::const_iterator i=varlst.begin(); i!=varlst.end(); ++i)
-                       if (!bp->is_polynomial(*i))
+               for (auto & it : varlst)
+                       if (!bp->is_polynomial(it))
                                return false;
                return true;
        }