#include "tensorstore/array.h"
template <typename Element,
         
 DimensionIndex Rank,
         
 ArrayOriginKind OriginKind,
         
 ContainerKind LayoutCKind>
  
requires (!IsShared<Element>)
SharedArray<Element, Rank, OriginKind, LayoutCKind>
tensorstore::UnownedToShared(
    
Array<Element, Rank, OriginKind, LayoutCKind> array);
template <typename T,
         
 typename Element,
         
 DimensionIndex Rank,
         
 ArrayOriginKind OriginKind,
         
 ContainerKind LayoutCKind>
  
requires (!IsShared<Element>)
SharedArray<Element, Rank, OriginKind, LayoutCKind>
tensorstore::UnownedToShared(
    
const std::shared_ptr<T>owned,
    
Array<Element, Rank, OriginKind, LayoutCKind> array);
template <typename Element,
         
 DimensionIndex Rank,
         
 ArrayOriginKind OriginKind,
         
 ContainerKind LayoutCKind>
SharedArray<Element, Rank, OriginKind, LayoutCKind>
tensorstore::UnownedToShared(
    
SharedArray<Element, Rank, OriginKind, LayoutCKind> array);

Converts an arbitrary array to a SharedArray.

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 the std::shared_ptr aliasing constructor. Cannot be specified if array is already a SharedArray.

Array<Element, Rank, OriginKind, LayoutCKind> array
SharedArray<Element, Rank, OriginKind, LayoutCKind> array

Existing array to return. If array is already a SharedArray, it is simply returned as is, i.e. the returned array shares ownership with array.