Fix error in push docs
Copying is O(n)—not the memory allocation
This commit is contained in:
parent
a9cfeb34dd
commit
bc52e5d4de
1 changed files with 5 additions and 4 deletions
|
@ -1921,10 +1921,11 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||||
///
|
///
|
||||||
/// # Time complexity
|
/// # Time complexity
|
||||||
///
|
///
|
||||||
/// Takes amortized *O*(1) time. If the vector's length would exceed its capacity after
|
/// Takes amortized *O*(1) time. If the vector's length would exceed its
|
||||||
/// the push, *O*(*capacity*) space is allocated, doubling the capacity and
|
/// capacity after the push, the capacity is doubled by allocating
|
||||||
/// taking *O*(*capacity*) time. This expensive operation is offset by the
|
/// *O*(*capacity*) space, then *O*(*capacity*) time to copy the vector's
|
||||||
/// *capacity* *O*(1) insertions it allows.
|
/// elements. This expensive operation is offset by the *capacity* *O*(1)
|
||||||
|
/// insertions it allows.
|
||||||
#[cfg(not(no_global_oom_handling))]
|
#[cfg(not(no_global_oom_handling))]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue