pub fn with_capacity(cap: usize, j: &Journal<A>) -> Self {
        if cap == 0 {
            Self::empty()
        } else {
            let layout = Layout::array::<T>(cap).unwrap();
            unsafe {
                let buf = A::new_uninit_for_layout(layout.size(), j);
                Self::from_off_len(A::off_unchecked(buf), cap, 0)
            }
        }
    }
/// Creates an empty `Vec` with the specified capacity
///
/// The vector will be able to hold exactly `capacity` elements without
/// reallocating. If `capacity` is 0, the vector will not allocate.
///
/// It is important to note that although the returned vector has the
/// *capacity* specified, the vector will have a zero *length*. For an
/// explanation of the difference between length and capacity, see
/// *[Capacity and reallocation]*.
///
/// # Examples
///
/// ```
/// # use corundum::vec::Vec;
/// # use corundum::alloc::heap::*;
/// Heap::transaction(|j| {
///     let mut vec = Vec::with_capacity(10, j);
///
///     // The vector contains no items, even though it has capacity for more
///     assert_eq!(vec.len(), 0);
///
///     // These are all done without reallocating...
///     for i in 0..10 {
///         vec.push(i, j);
///     }
///
///     // ...but this may make the vector reallocate
///     vec.push(11, j);
/// }).unwrap();
/// ```
Creates an empty `Vec` with the specified capacity
The vector will be able to hold exactly `capacity` elements without
reallocating. If `capacity` is 0, the vector will not allocate.

It is important to note that although the returned vector has the
capacity* specified, the vector will have a zero *length*. For an
explanation of the difference between length and capacity, see
[Capacity and reallocation]*.
Creates an empty ` Vec ` with the specified capacity The vector will be able to hold exactly ` capacity ` elements without reallocating . If ` capacity ` is 0 the vector will not allocate . It is important to note that although the returned vector has the capacity * specified the vector will have a zero * length * . For an explanation of the difference between length and capacity see [ Capacity and reallocation ] * .
pub fn with_capacity(cap: usize, j: &Journal<A>) -> Self {
        if cap == 0 {
            Self::empty()
        } else {
            let layout = Layout::array::<T>(cap).unwrap();
            unsafe {
                let buf = A::new_uninit_for_layout(layout.size(), j);
                Self::from_off_len(A::off_unchecked(buf), cap, 0)
            }
        }
    }
pub fn with_capacity ( cap : usize , j : & Journal < A > ) -> Self { if cap == 0 { Self :: empty ( ) } else { let layout = Layout :: array :: < T > ( cap ) . unwrap ( ) ; unsafe { let buf = A :: new_uninit_for_layout ( layout . size ( ) , j ) ; Self :: from_off_len ( A :: off_unchecked ( buf ) , cap , 0 ) } } }
Creates an empty `Vec` with the specified capacity
The vector will be able to hold exactly `capacity` elements without
reallocating.
Creates an empty ` Vec ` with the specified capacity The vector will be able to hold exactly ` capacity ` elements without reallocating .
cap
usize
j
&Journal<A>
examples
None
use corundum::vec::vec;
None
use corundum::alloc::heap::*;
:transaction(|j| {
let mut vec = Vec::with_capacity(10, j).

The vector contains no items, even though it has capacity for more
assert_eq!(vec.len(), 0).

These are all done without reallocating
for i in 0..10 {
vec.push(i, j);
}

but this may make the vector reallocate
vec.push(11, j);
}).unwrap();
```
: transaction ( |j| { let mut vec = Vec :: with_capacity ( 10 j ) . The vector contains no items even though it has capacity for more assert_eq! ( vec . len () 0 ) . These are all done without reallocating for i in 0 .. 10 { vec . push ( i j ) ; } but this may make the vector reallocate vec . push ( 11 j ) ; } ) . unwrap () ; ` ` `