Skip to content

Add support for std::swap

Describe the feature you would like to be implemented.

Add a mechanism so std::swap<T>(a&&, b&&) dispatches to a.swap(b)

Would such a feature be useful for other users? Why?

This would allow blocks of an array to be sorted using std::sort

Any hints on how to implement the requested feature?

According to this stack overflow post, adding template<typename T> void swap(T&& a, T&& b){ a.swap(b); } to the Eigen namespace would do the trick.

Additional resources