3ds Max C++ API Reference
Loading...
Searching...
No Matches
span< ElementType, Extent > Class Template Reference

#include <geom_span.hpp>

Public Types

using element_type = ElementType
 
using value_type = typename std::remove_cv< ElementType >::type
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using pointer = element_type *
 
using const_pointer = const element_type *
 
using reference = element_type &
 
using const_reference = const element_type &
 
using iterator = pointer
 
using reverse_iterator = std::reverse_iterator< iterator >
 
template<std::size_t Offset, std::size_t Count = dynamic_extent>
using subspan_return_t = span< ElementType, Count !=dynamic_extent ? Count :(Extent !=dynamic_extent ? Extent - Offset :dynamic_extent)>
 

Public Member Functions

template<std::size_t E = Extent, typename std::enable_if<(E==dynamic_extent||E<=0), int >::type = 0>
constexpr span () noexcept
 
TCB_SPAN_CONSTEXPR11 span (pointer ptr, size_type count)
 
TCB_SPAN_CONSTEXPR11 span (pointer first_elem, pointer last_elem)
 
template<std::size_t N, std::size_t E = Extent, typename std::enable_if<(E==dynamic_extent||N==E) &&detail::is_container_element_type_compatible< element_type(&)[N], ElementType >::value, int >::type = 0>
constexpr span (element_type(&arr)[N]) noexcept
 
template<std::size_t N, std::size_t E = Extent, typename std::enable_if<(E==dynamic_extent||N==E) &&detail::is_container_element_type_compatible< std::array< value_type, N > &, ElementType >::value, int >::type = 0>
TCB_SPAN_ARRAY_CONSTEXPR span (std::array< value_type, N > &arr) noexcept
 
template<std::size_t N, std::size_t E = Extent, typename std::enable_if<(E==dynamic_extent||N==E) &&detail::is_container_element_type_compatible< const std::array< value_type, N > &, ElementType >::value, int >::type = 0>
TCB_SPAN_ARRAY_CONSTEXPR span (const std::array< value_type, N > &arr) noexcept
 
template<typename Container , std::size_t E = Extent, typename std::enable_if< E==dynamic_extent &&detail::is_container< Container >::value &&detail::is_container_element_type_compatible< Container &, ElementType >::value, int >::type = 0>
constexpr span (Container &cont)
 
template<typename Container , std::size_t E = Extent, typename std::enable_if< E==dynamic_extent &&detail::is_container< Container >::value &&detail::is_container_element_type_compatible< const Container &, ElementType >::value, int >::type = 0>
constexpr span (const Container &cont)
 
constexpr span (const span &other) noexcept=default
 
template<typename OtherElementType , std::size_t OtherExtent, typename std::enable_if<(Extent==OtherExtent||Extent==dynamic_extent) &&std::is_convertible< OtherElementType(*)[], ElementType(*)[]>::value, int >::type = 0>
constexpr span (const span< OtherElementType, OtherExtent > &other) noexcept
 
 ~span () noexcept=default
 
TCB_SPAN_CONSTEXPR_ASSIGN spanoperator= (const span &other) noexcept=default
 
template<std::size_t Count>
TCB_SPAN_CONSTEXPR11 span< element_type, Count > first () const
 
template<std::size_t Count>
TCB_SPAN_CONSTEXPR11 span< element_type, Count > last () const
 
template<std::size_t Offset, std::size_t Count = dynamic_extent>
TCB_SPAN_CONSTEXPR11 subspan_return_t< Offset, Count > subspan () const
 
TCB_SPAN_CONSTEXPR11 span< element_type, dynamic_extentfirst (size_type count) const
 
TCB_SPAN_CONSTEXPR11 span< element_type, dynamic_extentlast (size_type count) const
 
TCB_SPAN_CONSTEXPR11 span< element_type, dynamic_extentsubspan (size_type offset, size_type count=dynamic_extent) const
 
constexpr size_type size () const noexcept
 
constexpr size_type size_bytes () const noexcept
 
TCB_SPAN_NODISCARD constexpr bool empty () const noexcept
 
TCB_SPAN_CONSTEXPR11 reference operator[] (size_type idx) const
 
TCB_SPAN_CONSTEXPR11 reference front () const
 
TCB_SPAN_CONSTEXPR11 reference back () const
 
constexpr pointer data () const noexcept
 
constexpr iterator begin () const noexcept
 
constexpr iterator end () const noexcept
 
TCB_SPAN_ARRAY_CONSTEXPR reverse_iterator rbegin () const noexcept
 
TCB_SPAN_ARRAY_CONSTEXPR reverse_iterator rend () const noexcept
 

Static Public Attributes

static constexpr size_type extent = Extent
 

Member Typedef Documentation

◆ element_type

using element_type = ElementType

◆ value_type

using value_type = typename std::remove_cv<ElementType>::type

◆ size_type

using size_type = std::size_t

◆ difference_type

using difference_type = std::ptrdiff_t

◆ pointer

◆ const_pointer

using const_pointer = const element_type*

◆ reference

◆ const_reference

using const_reference = const element_type&

◆ iterator

using iterator = pointer

◆ reverse_iterator

using reverse_iterator = std::reverse_iterator<iterator>

◆ subspan_return_t

using subspan_return_t = span<ElementType, Count != dynamic_extent ? Count : (Extent != dynamic_extent ? Extent - Offset : dynamic_extent)>

Constructor & Destructor Documentation

◆ span() [1/10]

constexpr span ( )
inlineconstexprnoexcept
324 {
325 }

◆ span() [2/10]

TCB_SPAN_CONSTEXPR11 span ( pointer  ptr,
size_type  count 
)
inline
328 : storage_(ptr, count)
329 {
331 }
static constexpr size_type extent
Definition: geom_span.hpp:319
#define TCB_SPAN_EXPECT(cond)
Definition: geom_span.hpp:78
TCB_SPAN_INLINE_VAR constexpr std::size_t dynamic_extent
Definition: geom_span.hpp:139

◆ span() [3/10]

TCB_SPAN_CONSTEXPR11 span ( pointer  first_elem,
pointer  last_elem 
)
inline
334 : storage_(first_elem, last_elem - first_elem)
335 {
336 TCB_SPAN_EXPECT(extent == dynamic_extent || last_elem - first_elem == static_cast<std::ptrdiff_t>(extent));
337 }

◆ span() [4/10]

constexpr span ( element_type(&)  arr[N])
inlineconstexprnoexcept
344 : storage_(arr, N)
345 {
346 }

◆ span() [5/10]

TCB_SPAN_ARRAY_CONSTEXPR span ( std::array< value_type, N > &  arr)
inlinenoexcept
354 : storage_(arr.data(), N)
355 {
356 }

◆ span() [6/10]

TCB_SPAN_ARRAY_CONSTEXPR span ( const std::array< value_type, N > &  arr)
inlinenoexcept
364 : storage_(arr.data(), N)
365 {
366 }

◆ span() [7/10]

constexpr span ( Container &  cont)
inlineconstexpr
373 : storage_(detail::data(cont), detail::size(cont))
374 {
375 }
constexpr auto size(const C &c) -> decltype(c.size())
Definition: geom_span.hpp:181
constexpr auto data(C &c) -> decltype(c.data())
Definition: geom_span.hpp:193

◆ span() [8/10]

constexpr span ( const Container &  cont)
inlineconstexpr
382 : storage_(detail::data(cont), detail::size(cont))
383 {
384 }

◆ span() [9/10]

constexpr span ( const span< ElementType, Extent > &  other)
constexprdefaultnoexcept

◆ span() [10/10]

constexpr span ( const span< OtherElementType, OtherExtent > &  other)
inlineconstexprnoexcept
393 : storage_(other.data(), other.size())
394 {
395 }

◆ ~span()

~span ( )
defaultnoexcept

Member Function Documentation

◆ operator=()

TCB_SPAN_CONSTEXPR_ASSIGN span & operator= ( const span< ElementType, Extent > &  other)
defaultnoexcept

◆ first() [1/2]

TCB_SPAN_CONSTEXPR11 span< element_type, Count > first ( ) const
inline
404 {
405 TCB_SPAN_EXPECT(Count <= size());
406 return { data(), Count };
407 }
constexpr size_type size() const noexcept
Definition: geom_span.hpp:447
constexpr pointer data() const noexcept
Definition: geom_span.hpp:481

◆ last() [1/2]

TCB_SPAN_CONSTEXPR11 span< element_type, Count > last ( ) const
inline
411 {
412 TCB_SPAN_EXPECT(Count <= size());
413 return { data() + (size() - Count), Count };
414 }

◆ subspan() [1/2]

TCB_SPAN_CONSTEXPR11 subspan_return_t< Offset, Count > subspan ( ) const
inline
422 {
423 TCB_SPAN_EXPECT(Offset <= size() && (Count == dynamic_extent || Offset + Count <= size()));
424 return { data() + Offset, Count != dynamic_extent ? Count : size() - Offset };
425 }
@ Offset
Definition: MouseCursors.h:308

◆ first() [2/2]

TCB_SPAN_CONSTEXPR11 span< element_type, dynamic_extent > first ( size_type  count) const
inline
428 {
429 TCB_SPAN_EXPECT(count <= size());
430 return { data(), count };
431 }

◆ last() [2/2]

434 {
435 TCB_SPAN_EXPECT(count <= size());
436 return { data() + (size() - count), count };
437 }

◆ subspan() [2/2]

TCB_SPAN_CONSTEXPR11 span< element_type, dynamic_extent > subspan ( size_type  offset,
size_type  count = dynamic_extent 
) const
inline
441 {
442 TCB_SPAN_EXPECT(offset <= size() && (count == dynamic_extent || offset + count <= size()));
443 return { data() + offset, count == dynamic_extent ? size() - offset : count };
444 }

◆ size()

constexpr size_type size ( ) const
inlineconstexprnoexcept
448 {
449 return storage_.size;
450 }
static constexpr std::size_t size
Definition: geom_span.hpp:157

◆ size_bytes()

constexpr size_type size_bytes ( ) const
inlineconstexprnoexcept
453 {
454 return size() * sizeof(element_type);
455 }
ElementType element_type
Definition: geom_span.hpp:308

◆ empty()

TCB_SPAN_NODISCARD constexpr bool empty ( ) const
inlineconstexprnoexcept
458 {
459 return size() == 0;
460 }

◆ operator[]()

TCB_SPAN_CONSTEXPR11 reference operator[] ( size_type  idx) const
inline
464 {
465 TCB_SPAN_EXPECT(idx < size());
466 return *(data() + idx);
467 }

◆ front()

TCB_SPAN_CONSTEXPR11 reference front ( ) const
inline
470 {
472 return *data();
473 }
TCB_SPAN_NODISCARD constexpr bool empty() const noexcept
Definition: geom_span.hpp:457

◆ back()

TCB_SPAN_CONSTEXPR11 reference back ( ) const
inline
476 {
478 return *(data() + (size() - 1));
479 }

◆ data()

constexpr pointer data ( ) const
inlineconstexprnoexcept
482 {
483 return storage_.ptr;
484 }
E * ptr
Definition: geom_span.hpp:156

◆ begin()

constexpr iterator begin ( ) const
inlineconstexprnoexcept
488 {
489 return data();
490 }

◆ end()

constexpr iterator end ( ) const
inlineconstexprnoexcept
493 {
494 return data() + size();
495 }

◆ rbegin()

TCB_SPAN_ARRAY_CONSTEXPR reverse_iterator rbegin ( ) const
inlinenoexcept
498 {
499 return reverse_iterator(end());
500 }
constexpr iterator end() const noexcept
Definition: geom_span.hpp:492
std::reverse_iterator< iterator > reverse_iterator
Definition: geom_span.hpp:317

◆ rend()

TCB_SPAN_ARRAY_CONSTEXPR reverse_iterator rend ( ) const
inlinenoexcept
503 {
504 return reverse_iterator(begin());
505 }
constexpr iterator begin() const noexcept
Definition: geom_span.hpp:487

Member Data Documentation

◆ extent

constexpr size_type extent = Extent
staticconstexpr