Supplement the document of fn as_ptr
This commit is contained in:
parent
b996a6f0ce
commit
65bc037b5d
|
@ -308,6 +308,15 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||||
///
|
///
|
||||||
/// If the matrix is not empty, this pointer is guaranteed to be aligned
|
/// If the matrix is not empty, this pointer is guaranteed to be aligned
|
||||||
/// and non-null.
|
/// and non-null.
|
||||||
|
///
|
||||||
|
/// # Example
|
||||||
|
/// ```
|
||||||
|
/// # use nalgebra::Matrix2;
|
||||||
|
/// let m = Matrix2::new(1, 2,
|
||||||
|
/// 3, 4);
|
||||||
|
/// let ptr = m.as_ptr();
|
||||||
|
/// assert_eq!(unsafe { *ptr }, m[0]);
|
||||||
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn as_ptr(&self) -> *const N {
|
pub fn as_ptr(&self) -> *const N {
|
||||||
self.data.ptr()
|
self.data.ptr()
|
||||||
|
|
Loading…
Reference in New Issue