Skip to content

Commit 5fd6b19

Browse files
committed
Fix Slice/Vec docs errors
1 parent 1fd9aed commit 5fd6b19

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

subspace/containers/slice.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,16 @@ class Slice {
6868
/// Returns true if the slice has a length of 0.
6969
constexpr inline bool is_empty() const& noexcept { return len_ == 0u; }
7070

71-
/// Returns a const reference the element at position `i` in the Slice.
71+
/// Returns a reference to the element at position `i` in the Slice.
7272
///
7373
/// # Panics
7474
/// If the index `i` is beyond the end of the slice, the function will panic.
75+
/// #[doc.overloads=slice.index.usize]
7576
constexpr inline const T& operator[](usize i) const& noexcept {
7677
check(i < len_);
7778
return data_[i.primitive_value];
7879
}
7980

80-
/// Returns a mutable reference the element at position `i` in the slice.
81-
///
82-
/// # Panics
83-
/// If the index `i` is beyond the end of the slice, the function will panic.
8481
constexpr T& operator[](usize i) & noexcept
8582
requires(!std::is_const_v<T>)
8683
{
@@ -143,6 +140,7 @@ class Slice {
143140
/// # Panics
144141
/// If the Range would otherwise contain an element that is out of bounds, the
145142
/// function will panic.
143+
/// #[doc.overloads=slice.index.range]
146144
constexpr inline Slice<T> operator[](
147145
const ::sus::ops::Range<usize> range) const noexcept {
148146
const usize len = range.end >= range.start ? range.end - range.start : 0u;

subspace/containers/vec.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,21 +371,21 @@ class Vec {
371371
return get_unchecked_mut(::sus::marker::unsafe_fn, i);
372372
}
373373

374-
/// #[doc.inherit=[n]sus::[n]containers::[r]Slice::[f]sort]
374+
/// #[doc.inherit=[n]sus::[n]ops::[r]Slice::[f]sort]
375375
void sort() { as_mut().sort(); }
376376

377-
/// #[doc.inherit=[n]sus::[n]containers::[r]Slice::[f]sort_by]
377+
/// #[doc.inherit=[n]sus::[n]ops::[r]Slice::[f]sort_by]
378378
template <class F, int&...,
379379
class R = std::invoke_result_t<F, const T&, const T&>>
380380
requires(::sus::ops::Ordering<R>)
381381
void sort_by(F compare) {
382382
as_mut().sort_by(sus::move(compare));
383383
}
384384

385-
/// #[doc.inherit=[n]sus::[n]containers::[r]Slice::[f]sort_unstable]
385+
/// #[doc.inherit=[n]sus::[n]ops::[r]Slice::[f]sort_unstable]
386386
void sort_unstable() { as_mut().sort(); }
387387

388-
/// #[doc.inherit=[n]sus::[n]containers::[r]Slice::[f]sort_unstable_by]
388+
/// #[doc.inherit=[n]sus::[n]ops::[r]Slice::[f]sort_unstable_by]
389389
template <class F, int&...,
390390
class R = std::invoke_result_t<F, const T&, const T&>>
391391
requires(::sus::ops::Ordering<R>)

0 commit comments

Comments
 (0)