Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::default_accessor

      From cppreference.com
      <cpp‎ |container‎ |mdspan
       
       
       
       
      Defined in header<mdspan>
      template<class ElementType>
      class default_accessor;
      (since C++23)

      A specialization ofstd::default_accessor class template is the defaultAccessorPolicy used bystd::mdspan if no user-specified accessor policy is provided.

      Each specialization ofdefault_accessor modelssemiregular and isTriviallyCopyable.

      Contents

      [edit]Template parameters

      ElementType - the element type. Shall be a complete object type that is neither an abstract class type nor an array type. Otherwise, the program is ill-formed

      [edit]Member types

      Member type Definition
      offset_policydefault_accessor
      element_typeElementType
      referenceElementType&
      data_handle_typeElementType*

      [edit]Member functions

      (constructor)
      constructs adefault_accessor
      (public member function)
      access
      returns a nth element provided by arguments
      (public member function)
      offset
      returns a data handle advanced by an offset value
      (public member function)

      std::default_accessor::default_accessor

      constexpr default_accessor()noexcept=default;
      (1)
      template<class OtherElementType>
      constexpr default_accessor( default_accessor<OtherElementType>)noexcept{}
      (2)
      1) Default constructs adefault_accessor.
      2) Constructs adefault_accessor fromdefault_accessor<OtherElementType>. The constructor has no visible effect. This overload participates in overload resolution only ifstd::is_convertible_v<OtherElementType(*)[], element_type(*)[]> is true.

      std::default_accessor::access

      constexpr reference access( data_handle_type p,std::size_t i)constnoexcept;

      Equivalent toreturn p[i];.

      std::default_accessor::offset

      constexpr data_handle_type offset( data_handle_type p,std::size_t i)constnoexcept;

      Equivalent toreturn p+ i;.

      [edit]Example

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

      [8]ページ先頭

      ©2009-2026 Movatter.jp