Skip to content
Snippets Groups Projects
Commit 02ea3efb authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Merge branch 'fix/59-deal-with-missing-swap-on-vc-proxy' into 'master'

[Vc] Deal with the missing swap() on Vc proxies.

Closes #59

See merge request !339
parents c12ea2dd ad6dde21
Branches
Tags
1 merge request!339[Vc] Deal with the missing swap() on Vc proxies.
Pipeline #
......@@ -152,23 +152,28 @@ namespace Dune
template<class T>
friend void swap(Proxy p1, T& s2)
{
using std::swap;
swap(p1.vec_[p1.idx_], s2);
// don't use swap() ourselves -- not supported by Vc 1.3.0 (but is
// supported by Vc 1.3.2)
T tmp = p1.vec_[p1.idx_];
p1.vec_[p1.idx_] = s2;
s2 = tmp;
}
template<class T>
friend void swap(T& s1, Proxy p2)
{
using std::swap;
swap(s1, p2.vec_[p2.idx_]);
T tmp = s1;
s1 = p2.vec_[p2.idx_];
p2.vec_[p2.idx_] = tmp;
}
};
template<class V1, class V2>
void swap(Proxy<V1> p1, Proxy<V2> p2)
{
using std::swap;
swap(p1.vec_[p1.idx_], p2.vec_[p2.idx_]);
typename V1::value_type tmp = p1.vec_[p1.idx_];
p1.vec_[p1.idx_] = p2.vec_[p2.idx_];
p2.vec_[p2.idx_] = tmp;
}
} // namespace VcImpl
#endif // HAVE_VC
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment