-
#include "tensorstore/index_space/transformed_array.h"
-
template <typename Element,
DimensionIndex Rank,
ContainerKind LayoutCKind>
requires (!IsShared<Element>)
TransformedArray<Shared<Element>, Rank, LayoutCKind>
tensorstore::UnownedToShared(
TransformedArray<Element, Rank, LayoutCKind> array); -
template <typename T,
typename Element,
DimensionIndex Rank,
ContainerKind LayoutCKind>
requires (!IsShared<Element>)
TransformedArray<Shared<Element>, Rank, LayoutCKind>
tensorstore::UnownedToShared(
const std::shared_ptr<T>& owned,
TransformedArray<Element, Rank, LayoutCKind> array); -
template <typename Element,
DimensionIndex Rank,
ContainerKind LayoutCKind>
TransformedArray<Shared<Element>, Rank, LayoutCKind>
tensorstore::UnownedToShared(
TransformedArray<Shared<Element>, Rank, LayoutCKind> array); Converts an arbitrary
TransformedArray
to aTransformedSharedArray
.Warning
The caller is responsible for ensuring that the returned array is not used after the element data to which it points becomes invalid.
- Parameters:¶
- const std::shared_ptr<T> &owned
If specified, the returned array shares ownership with the
owned
pointer, in the same way as thestd::shared_ptr
aliasing constructor. Cannot be specified ifarray
is already aTransformedSharedArray
.- TransformedArray<Element, Rank, LayoutCKind> array¶
- TransformedArray<Shared<Element>, Rank, LayoutCKind> array
Existing array to return. If
array
is already aTransformedSharedArray
, it is simply returned as is, i.e. the returned array shares ownership witharray
.