File tree 4 files changed +15
-0
lines changed
4 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ public:
40
40
class iterator;
41
41
iterator begin() const noexcept;
42
42
iterator end() const noexcept;
43
+
44
+ void swap(Slice &) noexcept;
43
45
};
44
46
#
45
47
# template <typename T>
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ public:
44
44
bool operator<=(const Str &) const noexcept;
45
45
bool operator>(const Str &) const noexcept;
46
46
bool operator>=(const Str &) const noexcept;
47
+
48
+ void swap(Str &) noexcept;
47
49
};
48
50
49
51
std::ostream &operator<<(std::ostream &, const Str &);
Original file line number Diff line number Diff line change @@ -125,6 +125,8 @@ class Str final {
125
125
bool operator >(const Str &) const noexcept ;
126
126
bool operator >=(const Str &) const noexcept ;
127
127
128
+ void swap (Str &) noexcept ;
129
+
128
130
private:
129
131
std::array<std::uintptr_t , 2 > repr;
130
132
};
@@ -175,6 +177,8 @@ class Slice final
175
177
iterator begin () const noexcept ;
176
178
iterator end () const noexcept ;
177
179
180
+ void swap (Slice &) noexcept ;
181
+
178
182
private:
179
183
// Not necessarily ABI compatible with &[T]. Codegen will translate to
180
184
// cxx::rust_slice::RustSlice which matches this layout.
@@ -666,6 +670,11 @@ typename Slice<T>::iterator Slice<T>::end() const noexcept {
666
670
it.pos = static_cast <char *>(it.pos ) + it.stride * this ->len ;
667
671
return it;
668
672
}
673
+
674
+ template <typename T>
675
+ void Slice<T>::swap(Slice &rhs) noexcept {
676
+ std::swap (*this , rhs);
677
+ }
669
678
#endif // CXXBRIDGE1_RUST_SLICE
670
679
671
680
#ifndef CXXBRIDGE1_RUST_BOX
Original file line number Diff line number Diff line change @@ -267,6 +267,8 @@ bool Str::operator>(const Str &rhs) const noexcept { return rhs < *this; }
267
267
268
268
bool Str::operator >=(const Str &rhs) const noexcept { return rhs <= *this ; }
269
269
270
+ void Str::swap (Str &rhs) noexcept { std::swap (*this , rhs); }
271
+
270
272
std::ostream &operator <<(std::ostream &os, const Str &s) {
271
273
os.write (s.data (), s.size ());
272
274
return os;
You can’t perform that action at this time.
0 commit comments