]> www.ginac.de Git - ginac.git/blobdiff - ginac/expair.h
inlined ex::swap() and provided versions of iter_swap() for ex and expair
[ginac.git] / ginac / expair.h
index 954442509e40a52cc1f7f370c977368db6e28a79..925db97230ea8f471416b27ccedfe9a1328f6925 100644 (file)
@@ -111,6 +111,13 @@ struct expair_swap : public std::binary_function<expair, expair, void> {
        void operator()(expair &lh, expair &rh) const { lh.swap(rh); }
 };
 
+inline void swap(expair & e1, expair & e2)
+{ e1.swap(e2); }
+
+// This makes STL algorithms use the more efficient swap operation for ex objects
+inline void iter_swap(std::vector<expair>::iterator i1, std::vector<expair>::iterator i2)
+{ i1->swap(*i2); }
+
 } // namespace GiNaC
 
 #endif // ndef __GINAC_EXPAIR_H__