Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::mdspan::mdspan(3)	      C++ Standard Libary	std::mdspan::mdspan(3)

NAME
       std::mdspan::mdspan - std::mdspan::mdspan

Synopsis
	  constexpr						     mdspan();
       (1)  (since C++23)
	  template< class... OtherIndexTypes >
	      constexpr	    explicit	 mdspan(      data_handle_type	    p,
       (2)  (since C++23)
	  OtherIndexTypes... exts );
	  template< class OtherIndexType, std::size_t N	>

	      constexpr		 explicit(N	    !=	       rank_dynamic())
       (3)  (since C++23)

		  mdspan( data_handle_type p, std::span<OtherIndexType,	N>
	  exts );
	  template< class OtherIndexType, std::size_t N	>

	      constexpr		explicit(N	   !=	       rank_dynamic())
       (4)  (since C++23)

		  mdspan( data_handle_type p, const
	  std::array<OtherIndexType, N>& exts );
	  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,
       (7)  (since C++23)
			    const accessor_type& a );
	  template< class OtherElementType, class OtherExtents,

		    class OtherLayoutPolicy, class OtherAccessor >
	      constexpr	       explicit(/*	  see	     below	   */)
       (8)  (since C++23)
		  mdspan( const	mdspan<OtherElementType, OtherExtents,

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

	  Constructs  an mdspan, optionally using user-supplied	data handle p,
       layout mapping
	  m, and accessor a. If	extents	exts or	ext  are  supplied,  they  are
       converted to
	  extents_type and used	to initialize the layout mapping.

	  1)  Constructs  an  empty  mdspan. Value-initializes ptr_, map_, and
       acc_.
	    * The behavior is undefined	if [0,	map_.required_span_size())  is
       not an accessible
	      range of ptr_ and	acc_ for the values of map_ and	acc_ after the
       invocation of
	      this constructor.
	    * This overload participates in overload resolution	only if

	    * rank_dynamic() > 0 is true,
	    * std::is_default_constructible_v<data_handle_type>	is true,
	    * std::is_default_constructible_v<mapping_type> is true, and
	    * std::is_default_constructible_v<accessor_type> is	true.
	  2)  Constructs an mdspan over	the underlying data referred by	p with
       extents
	  represented by exts.... Value-initializes acc_, direct-non-list-ini-
       tializes	ptr_
	  with std::move(p) and	map_ with
	  extents_type(static_cast<index_type>(std::move(exts))...).
	    * The behavior is undefined	if [0,	map_.required_span_size())  is
       not an accessible
	      range of ptr_ and	acc_ for the values of map_ and	acc_ after the
       invocation of
	      this constructor.
	    *  Let N be	sizeof...(OtherIndexTypes). This overload participates
       in overload
	      resolution only if

	    * (std::is_convertible_v<OtherIndexTypes, index_type> &&  ...)  is
       true,
	    *  (std::is_nothrow_constructible<index_type,  OtherIndexTypes> &&
       ...) is true,
	    * N	== rank() || N == rank_dynamic() is true,
	    * std::is_constructible_v<mapping_type, extents_type> is true, and
	    * std::is_default_constructible_v<accessor_type> is	true.
	  3,4) Constructs an mdspan over the underlying	 data  referred	 by  p
       with extents
	  represented  by  pack	exts. Value-initializes	acc_, direct-non-list-
       initializes ptr_
	  with std::move(p) and	map_ with extents_type(exts).
	    * The behavior is undefined	if [0,	map_.required_span_size())  is
       not an accessible
	      range of ptr_ and	acc_ for the values of map_ and	acc_ after the
       invocation of
	      this constructor.
	    * This overload participates in overload resolution	only if

	    *  std::is_convertible_v<const  OtherIndexTypes&,  index_type>  is
       true,
	    *  std::is_nothrow_constructible<index_type,   const   OtherIndex-
       Types&> is true,
	    * N	== rank() || N == rank_dynamic() is true,
	    * std::is_constructible_v<mapping_type, extents_type> is true, and
	    * std::is_default_constructible_v<accessor_type> is	true.
	  5)  Constructs an mdspan over	the underlying data referred by	p with
       extents
	  represented by ext. Value-initializes	acc_, direct-non-list-initial-
       izes ptr_ with
	  std::move(p) and map_	with exts.
	    * The behavior is undefined	if [0,	map_.required_span_size())  is
       not an accessible
	      range  of	 p  and	acc_ for the values of map_ and	acc_ after the
       invocation of this
	      constructor.
	    * This overload participates in overload resolution	only if

	    * std::is_constructible_v<mapping_type,  const  mapping_type&>  is
       true, and
	    * std::is_default_constructible_v<accessor_type> is	true.
	  6)  Constructs an mdspan over	the underlying data referred by	p with
       layout mapping
	  m. Value-initializes	acc_,  direct-non-list-initializes  ptr_  with
       std::move(p) and
	  map_ with m.
	    *  The behavior is undefined if [0,	m.required_span_size())	is not
       an accessible
	      range of p and acc_ for the values of acc_ after the  invocation
       of this
	      constructor.
	    * This overload participates in overload resolution	only if
	      std::is_default_constructible_v<accessor_type> is	true.
	  7)  Constructs an mdspan over	the underlying data referred by	p with
       layout mapping m
	  and accessor a. Direct-non-list-initializes ptr_ with	 std::move(p),
       map_ with m and
	  acc_ with a.
	    *  The behavior is undefined if [0,	m.required_span_size())	is not
       an accessible
	      range of p and a after the invocation of this constructor.
	  8) Converting	constructor from another mdspan.  Direct-non-list-ini-
       tializes	ptr_ with
	  other.ptr_, map_ with	other.map_ and acc_ with other.acc_.
	    * The behavior is undefined	if :

	    *  [0,  map_.required_span_size())	is  not	an accessible range of
       ptr_ and	acc_ for
	      the values of map_ and acc_ after	the invocation	of  this  con-
       structor, or
	    *  for  each  rank	index r	of extents_type,    extents_type::sta-
       tic_extent(r) ==
	      std::dynamic_extent
	      || extents_type::static_extent(r)	== other.extent(r) is false.
	    * This overload participates in overload resolution	only if

	    * std::is_constructible_v<mapping_type, const OtherLayoutPolicy::
		  template mapping<OtherExtents>&> is true, and
	    * std::is_constructible_v<accessor_type, const OtherAccessor&>  is
       true.
	    * The program is ill-formed	if:

	    * std::is_constructible_v<data_handle_type,
		  const	OtherAccessor::data_handle_type&> is false, or
	    * std::is_constructible_v<extents_type, OtherExtents> is false.
	    *	 The	expression   inside   explicit	 is   equivalent   to:
       !std::is_convertible_v<const
	      OtherLayoutPolicy::
		     template mapping<OtherExtents>&, mapping_type>
	      || !std::is_convertible_v<const OtherAccessor&, accessor_type>
	  9) Defaulted copy constructor.
	  10) Defaulted	move constructor.

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

Example
	   This	section	is incomplete
	   Reason: no example

References
	    * C++23 standard (ISO/IEC 14882:2023):

	    * 24.7.3.6.2 Constructors [mdspan.mdspan.cons]

See also
	   This	section	is incomplete

Categories:
	    * Todo no example
	    * Todo without reason

http://cppreference.com		  2024.06.10		std::mdspan::mdspan(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::mdspan::mdspan&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help