Report a bug
If you spot a problem with this page, click here to create a Github issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

mir.ndslice.connect.cpp

This is a submodule of mir.ndslice.
The module provides wrappers for Slice  that can be used as arguments for extern(C++) functions.
Authors:
Ilya Yaroshenko
Examples:
CppSlice definition. It is not shown in the docs because of a DDOC bug. See also C++ ndslice header.
// extern(C++, ndslice) - ndslice namespace
struct CppSlice(SliceKind kind, int N, Iterator)
{extern(D):
    ///
    Slice!(kind, [N], Iterator) _slice;
    ///
    alias _slice this;
    ///
    this()(Slice!(kind, [N], Iterator) slice)
    {
        this._slice = slice;
    }
}
Examples:
static extern(C++) void fillEye(CppContiguousMatrix!double matrix)
{
    import mir.ndslice.topology: diagonal;
    matrix[] = 0;
    matrix.diagonal[] = 1;
}

import mir.ndslice.allocation;

auto mat = stdcUninitSlice!double(2, 3).cppSlice;
fillEye(mat);
mat.stdcFreeSlice;
CppSlice!(kind, packs[0], Iterator) cppSlice(SliceKind kind, size_t[] packs, Iterator)(Slice!(kind, packs, Iterator) slice);
Converts Slice  to appropriate CppSlice type.
template CppContiguousVector(T)

template CppUniversalVector(T)

template CppContiguousMatrix(T)

template CppCanonicalMatrix(T)

template CppUniversalMatrix(T)

template CppContiguousSlice(int dim, T)

template CppCanonicalSlice(int dim, T)

template CppUniversalSlice(int dim, T)
Aliases