It's a myth that iter_swap helps the compiler produce better code.
Let's just use specialized swap instead.
a.swap(b);
}
-/** Specialization of std::iter_swap() for vector<ex> iterators. */
-template <>
-inline void iter_swap(vector<GiNaC::ex>::iterator i1, vector<GiNaC::ex>::iterator i2)
-{
- i1->swap(*i2);
-}
-
-/** Specialization of std::iter_swap() for list<ex> iterators. */
-template <>
-inline void iter_swap(list<GiNaC::ex>::iterator i1, list<GiNaC::ex>::iterator i2)
-{
- i1->swap(*i2);
-}
-
} // namespace std
#endif // ndef GINAC_EX_H
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
template <class It>
int permutation_sign(It first, It last)
{
+ using std::swap;
if (first == last)
return 0;
--last;
bool swapped = false;
while (i != first) {
if (*i < *other) {
- std::iter_swap(other, i);
+ swap(*other, *i);
flag = other;
swapped = true;
sign = -sign;
swapped = false;
while (i != last) {
if (*other < *i) {
- std::iter_swap(i, other);
+ swap(*i, *other);
flag = other;
swapped = true;
sign = -sign;