Restore swapping Str and Slice in member function form only
diff --git a/include/cxx.h b/include/cxx.h
index ee4de41..03f719f 100644
--- a/include/cxx.h
+++ b/include/cxx.h
@@ -125,6 +125,8 @@
bool operator>(const Str &) const noexcept;
bool operator>=(const Str &) const noexcept;
+ void swap(Str &) noexcept;
+
private:
std::array<std::uintptr_t, 2> repr;
};
@@ -175,6 +177,8 @@
iterator begin() const noexcept;
iterator end() const noexcept;
+ void swap(Slice &) noexcept;
+
private:
// Not necessarily ABI compatible with &[T]. Codegen will translate to
// cxx::rust_slice::RustSlice which matches this layout.
@@ -666,6 +670,11 @@
it.pos = static_cast<char *>(it.pos) + it.stride * this->len;
return it;
}
+
+template <typename T>
+void Slice<T>::swap(Slice &rhs) noexcept {
+ std::swap(*this, rhs);
+}
#endif // CXXBRIDGE1_RUST_SLICE
#ifndef CXXBRIDGE1_RUST_BOX