Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::mdspan<T,Extents,LayoutPolicy,AccessorPolicy>::mdspan

      From cppreference.com
      <cpp‎ |container‎ |mdspan
       
       
       
       
      constexpr mdspan();
      (1)(since C++23)
      template<class...OtherIndexTypes>
         constexprexplicit mdspan( data_handle_type p, OtherIndexTypes...exts);
      (2)(since C++23)
      template<class OtherIndexType,std::size_t N>

         constexprexplicit(N!= rank_dynamic())

              mdspan( data_handle_type p,std::span<OtherIndexType, N> exts);
      (3)(since C++23)
      template<class OtherIndexType,std::size_t N>

         constexprexplicit(N!= rank_dynamic())
              mdspan( data_handle_type p,

                     conststd::array<OtherIndexType, N>& exts);
      (4)(since C++23)
      constexpr mdspan( data_handle_type p,const extents_type& ext);
      (5)(since C++23)
      constexpr mdspan( data_handle_type p,const mapping_type& m);
      (6)(since C++23)
      constexpr mdspan( data_handle_type p,const mapping_type& m,
                       const accessor_type& a);
      (7)(since C++23)
      template<class OtherElementType,class OtherExtents,

               class OtherLayoutPolicy,class OtherAccessor>
         constexprexplicit(/* see below */)
              mdspan(const mdspan<OtherElementType, OtherExtents,

                                   OtherLayoutPolicy, OtherAccessor>& other);
      (8)(since C++23)
      constexpr mdspan(const mdspan& rhs)=default;
      (9)(since C++23)
      constexpr mdspan( mdspan&& rhs)=default;
      (10)(since C++23)

      Constructs anmdspan, optionally using user-supplied data handlep, layout mappingm, and accessora. If extentsexts orext are supplied, they are converted toextents_type and used to initialize the layout mapping.

      Contents

      [edit]Parameters

      p - a handle to the underlying data
      m - a layout mapping
      a - an accessor
      ext - astd::extents object
      exts - represents a multi-dimensional extents
      other - another mdspan to convert from
      rhs - another mdspan to copy or move from

      [edit]Effects

      For the data members listed in the table below:

       Overload Initializer for...
      ptr_map_acc_
      (1)(empty)
      (2)std::move(p)extents_type
         (static_cast<index_type>
               (std::move(exts))...)
      (empty)
      (3)extents_type(exts)
      (4)
      (5)ext
      (6)m
      (7)a
      (8)other.ptr_other.map_other.acc_

      [edit]Constraints and supplement information

      1) This overload participates in overload resolution only if all following values aretrue:
      If[0map_ .required_span_size()) is not anaccessible range ofptr_ andacc_ for the values ofmap_ andacc_ after the invocation of this constructor, the behavior is undefined.
      2) This overload participates in overload resolution only if all following values aretrue:
      If[0map_ .required_span_size()) is not an accessible range ofp andacc_ for the values ofmap_ andacc_ after the invocation of these constructors, the behavior is undefined.
      3,4) These overloads participate in overload resolution only if all following values aretrue:
      If[0map_ .required_span_size()) is not an accessible range ofp andacc_ for the values ofmap_ andacc_ after the invocation of these constructors, the behavior is undefined.
      5) This overload participates in overload resolution only if all following values aretrue:
      If[0map_ .required_span_size()) is not an accessible range ofp andacc_ for the values ofmap_ andacc_ after the invocation of these constructors, the behavior is undefined.
      6) This overload participates in overload resolution only ifstd::is_default_constructible_v<accessor_type> istrue.
      If[0m.required_span_size()) is an accessible range ofp andacc_ for the value ofacc_ after the invocation of this constructor, the behavior is undefined.
      7) If[0m.required_span_size()) is not an accessible range ofp anda, the behavior is undefined.
      8) The expression insideexplicit is equivalent to!std::is_convertible_v<const OtherLayoutPolicy::template mapping<OtherExtents>&,
                             mapping_type>
         ||!std::is_convertible_v<const OtherAccessor&, accessor_type>
      .
      This overload participates in overload resolution only if all following values aretrue:
      If any of the following values isfalse, the program is ill-formed:
      If[0map_ .required_span_size()) is not an accessible range ofptr_ andacc_ for the values ofptr_,map_ andacc_ after the invocation of this constructor, the behavior is undefined.

      Ifstatic_extent(r)==std::dynamic_extent
         || static_extent(r)== other.extent(r)
      isfalse for some rank indexr ofextents_type, the behavior is undefined.

      (until C++26)

      Ifstatic_extent(r)==std::dynamic_extent
         || static_extent(r)== other.extent(r)
      isfalse for some rank indexr ofextents_type:

      • If the implementation ishardened, acontract violation occurs. Moreover, if the contract-violation handler returns under “observe” evaluation semantic, the behavior is undefined.
      • If the implementation is not hardened, the behavior is undefined.
      (since C++26)

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]References

      • C++23 standard (ISO/IEC 14882:2024):
      • 24.7.3.6.2 Constructors [mdspan.mdspan.cons]

      [edit]See also

      This section is incomplete
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/container/mdspan/mdspan&oldid=182298"

      [8]ページ先頭

      ©2009-2025 Movatter.jp