|
LibSWOC++ 1.5.14
Solid Wall of C++
|


Public Types | |
| using | value_type = void |
| using | pointer_type = value_type * |
| using | value_type |
| Element type for span. | |
| using | iterator |
| Iterator. | |
| using | const_iterator |
| Constant iterator. | |
Public Types inherited from swoc::MemSpan< T > | |
| using | value_type = T |
| Element type for span. | |
| using | iterator = T * |
| Iterator. | |
| using | const_iterator = T const * |
| Constant iterator. | |
Public Member Functions | |
| constexpr | MemSpan ()=default |
| Default constructor (empty buffer). | |
| constexpr | MemSpan (self_type const &that)=default |
| Copy constructor. | |
| constexpr self_type & | operator= (self_type const &that)=default |
| Copy assignment. | |
| template<typename U> | |
| constexpr | MemSpan (MemSpan< U > const &that) |
| constexpr | MemSpan (value_type *start, size_t n) |
| MemSpan (value_type *begin, value_type *end) | |
| template<auto N, typename U> | |
| constexpr | MemSpan (U(&a)[N]) |
| constexpr | MemSpan (std::nullptr_t) |
| constexpr value_type * | data () const |
| Pointer to memory in the span. | |
| value_type * | data_end () const |
| Pointer to just after memory in the span. | |
| template<typename U> | |
| self_type & | operator= (MemSpan< U > const &that) |
| template<typename C, typename = std::enable_if_t<!std::is_const_v<decltype(std::declval<C>().data()[0])> && std::is_convertible_v<decltype(std::declval<C>().size()), size_t>> | |
| constexpr | MemSpan (C const &c) |
| self_type & | assign (value_type *ptr, size_t n) |
| self_type & | assign (value_type *first, value_type const *last) |
| self_type | prefix (size_t n) const |
| self_type & | remove_prefix (size_t count) |
| self_type | clip_prefix (size_t n) |
| self_type | suffix (size_t n) const |
| self_type & | remove_suffix (size_t n) |
| self_type | clip_suffix (size_t n) |
| constexpr self_type | subspan (size_t offset, size_t n) const |
| template<typename T> | |
| self_type | align () const |
| self_type | align (size_t alignment) const |
| self_type | align (size_t alignment, size_t obj_size) const |
| template<typename U> | |
| MemSpan< U > | rebind () const |
| template<typename U> | |
| U * | as_ptr () const |
| self_type & | clear () |
| Clear the span (become an empty span). | |
| auto | make (Args &&...args) -> self_type & |
| constexpr | MemSpan (MemSpan< U > const &that) |
| constexpr | MemSpan (U(&a)[N]) |
| template<typename U> | |
| auto | operator= (MemSpan< U > const &that) -> self_type & |
| template<typename T> | |
| auto | align () const -> self_type |
| auto | rebind () const -> self_type |
| template<> | |
| auto | rebind () const -> self_type |
| template<> | |
| auto | rebind () const -> MemSpan< void const > |
| constexpr | MemSpan ()=default |
| Default constructor (empty buffer). | |
| constexpr | MemSpan (self_type const &that)=default |
| Copy constructor. | |
| constexpr | MemSpan (self_type &that)=default |
| Copy constructor. | |
| constexpr | MemSpan (value_type *ptr, size_t count) |
| constexpr | MemSpan (value_type *begin, value_type *end) |
| constexpr | MemSpan (void(&a)[N]) |
| constexpr | MemSpan (std::array< U, N > const &a) |
| constexpr | MemSpan (std::array< void, N > &a) |
| constexpr | MemSpan (MemSpan< U > const &that) |
| constexpr | MemSpan (C &c) |
| constexpr | MemSpan (C const &c) |
| constexpr | MemSpan (std::nullptr_t) |
| constexpr | MemSpan (MemSpan< U > const &that) |
| constexpr | MemSpan (U(&a)[N]) |
| constexpr bool | operator== (self_type const &that) const |
| bool | is_same (self_type const &that) const |
| constexpr bool | operator!= (self_type const &that) const |
| self_type & | operator= (self_type const &that)=default |
| Assignment - the span is copied, not the content. | |
| void & | operator[] (size_t idx) const |
| Access element at index idx. | |
| bool | operator! () const |
| operator bool () const | |
| constexpr bool | empty () const |
| auto | rebind () const -> self_type |
| auto | make (Args &&...args) -> self_type & |
Public Member Functions inherited from swoc::MemSpan< T > | |
| constexpr | MemSpan ()=default |
| Default constructor (empty buffer). | |
| constexpr | MemSpan (self_type const &that)=default |
| Copy constructor. | |
| constexpr | MemSpan (self_type &that)=default |
| Copy constructor. | |
| constexpr | MemSpan (value_type *ptr, size_t count) |
| constexpr | MemSpan (value_type *begin, value_type *end) |
| template<auto N> | |
| constexpr | MemSpan (T(&a)[N]) |
| template<auto N, typename U, typename META = std::enable_if_t<std::conjunction_v<std::is_const<T>, std::is_same<std::remove_const_t<U>, std::remove_const_t<T>>>>> | |
| constexpr | MemSpan (std::array< U, N > const &a) |
| template<auto N> | |
| constexpr | MemSpan (std::array< T, N > &a) |
| template<typename U, typename META = std::enable_if_t<std::conjunction_v<std::is_const<T>, std::is_same<U, std::remove_const_t<T>>>>> | |
| constexpr | MemSpan (MemSpan< U > const &that) |
| template<typename C, typename = std::enable_if_t<std::is_convertible_v<decltype(std::declval<C>().data()), T *> && std::is_convertible_v<decltype(std::declval<C>().size()), size_t>> | |
| constexpr | MemSpan (C &c) |
| template<typename C, typename = std::enable_if_t<std::is_convertible_v<decltype(std::declval<C>().data()), T *> && std::is_convertible_v<decltype(std::declval<C>().size()), size_t>> | |
| constexpr | MemSpan (C const &c) |
| constexpr | MemSpan (std::nullptr_t) |
| constexpr bool | operator== (self_type const &that) const |
| bool | is_same (self_type const &that) const |
| constexpr bool | operator!= (self_type const &that) const |
| self_type & | operator= (self_type const &that)=default |
| Assignment - the span is copied, not the content. | |
| T & | operator[] (size_t idx) const |
| Access element at index idx. | |
| bool | operator! () const |
| operator bool () const | |
| constexpr bool | empty () const |
| template<typename... Args> | |
| auto | make (Args &&...args) -> self_type & |
| template<typename U> | |
| constexpr | MemSpan (MemSpan< U > const &that) |
| template<auto N, typename U> | |
| constexpr | MemSpan (U(&a)[N]) |
| auto | rebind () const -> self_type |
| constexpr T * | begin () const |
| Pointer to the first element in the span. | |
| constexpr T * | end () const |
| Pointer to first element not in the span. | |
| constexpr size_t | size () const |
| Number of elements in the span. | |
| constexpr size_t | count () const |
| constexpr size_t | length () const |
| Number of elements in the span. | |
| constexpr size_t | data_size () const |
| Number of bytes in the span. | |
| T * | data () const |
| constexpr T * | data_end () const |
| T & | front () |
| T & | back () |
| template<typename F> | |
| self_type & | apply (F &&f) |
| template<typename U = std::conditional_t<std::is_const_v<T>, void const, void>> | |
| MemSpan< U > | rebind () const |
| self_type & | assign (T *ptr, size_t count) |
| self_type & | assign (T *first, T const *last) |
| self_type & | clear () |
| Clear the span (become an empty span). | |
| bool | contains (value_type const *p) const |
| constexpr self_type | prefix (size_t count) const |
| constexpr self_type | first (size_t count) const |
| self_type & | remove_prefix (size_t count) |
| self_type | clip_prefix (size_t count) |
| constexpr self_type | suffix (size_t count) const |
| constexpr self_type | last (size_t count) const |
| self_type & | remove_suffix (size_t count) |
| self_type | clip_suffix (size_t count) |
| constexpr self_type | subspan (size_t offset, size_t count) const |
| constexpr self_type & | restrict (size_t n) |
| template<typename... Args> | |
| self_type & | make (Args &&...args) |
| void | destroy () |
| Destruct all elements in the span. | |
Protected Member Functions | |
| MemSpan (super_type const &super) | |
Protected Attributes | |
| void * | _ptr |
| Pointer to base of memory chunk. | |
| size_t | _count |
| Number of elements. | |
Protected Attributes inherited from swoc::MemSpan< T > | |
| T * | _ptr = nullptr |
| Pointer to base of memory chunk. | |
| size_t | _count = 0 |
| Number of elements. | |
Accessors. | |
| constexpr void * | begin () const |
| Pointer to the first element in the span. | |
| constexpr void * | end () const |
| Pointer to first element not in the span. | |
| constexpr size_t | size () const |
| Number of elements in the span. | |
| constexpr size_t | count () const |
| constexpr size_t | length () const |
| Number of elements in the span. | |
| constexpr size_t | data_size () const |
| Number of bytes in the span. | |
| void * | data () const |
| constexpr void * | data_end () const |
| void & | front () |
| void & | back () |
| self_type & | apply (F &&f) |
| MemSpan< U > | rebind () const |
| self_type & | assign (void *ptr, size_t count) |
| self_type & | assign (void *first, void const *last) |
| self_type & | clear () |
| Clear the span (become an empty span). | |
| bool | contains (value_type const *p) const |
| constexpr self_type | prefix (size_t count) const |
| constexpr self_type | first (size_t count) const |
| self_type & | remove_prefix (size_t count) |
| self_type | clip_prefix (size_t count) |
| constexpr self_type | suffix (size_t count) const |
| constexpr self_type | last (size_t count) const |
| self_type & | remove_suffix (size_t count) |
| self_type | clip_suffix (size_t count) |
| constexpr self_type | subspan (size_t offset, size_t count) const |
| constexpr self_type & | restrict (size_t n) |
| self_type & | make (Args &&...args) |
| void | destroy () |
| Destruct all elements in the span. | |
| using swoc::MemSpan< void >::const_iterator |
| using swoc::MemSpan< void >::iterator |
| using swoc::MemSpan< void >::pointer_type = value_type * |
| using swoc::MemSpan< void >::value_type |
| using swoc::MemSpan< void >::value_type = void |
|
constexpr |
|
inlineconstexpr |
|
inline |
|
constexpr |
|
inlineconstexpr |
|
constexpr |
|
inlineprotected |
Construct from const void span.
| super | Source span. |
const correctness is not violated by converting a const span. The primary use is to enable void span method implementations to return a const span as self_type without explicit casting. In such cases the original span was not const and so there is no violation.
|
constexpr |
|
constexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
inlineconstexpr |
|
constexpr |
|
constexpr |
Construct from any vector like container.
| C | Container type. |
| c | container |
The container type must have the methods data and size which must return values convertible to the pointer type for T and size_t respectively.
|
inlineconstexpr |
|
constexpr |
|
constexpr |
| self_type swoc::MemSpan< void >::align | ( | ) | const |
Align span for a type.
| T | Alignment type. |
The minimum amount of space is removed from the front to yield an aligned span. If the span is not large enough to perform the alignment, the pointer is aligned and the size reduced to zero (empty).
| auto swoc::MemSpan< void >::align | ( | ) | const -> self_type |
|
inline |
Force memory alignment.
| alignment | Alignment size (must be power of 2). |
The minimum amount of space is removed from the front to yield an aligned span. If the span is not large enough to perform the alignment, the pointer is aligned and the size reduced to zero (empty).
|
inline |
Force memory alignment.
| alignment | Alignment size (must be power of 2). |
| obj_size | Size of instances requiring alignment. |
The minimum amount of space is removed from the front to yield an aligned span. If the span is not large enough to perform the alignment, the pointer is aligned and the size reduced to zero (empty). Trailing space is discarded such that the resulting memory space is a multiple of size.
sizeof is used. | MemSpan< void >::self_type & swoc::MemSpan< void >::apply | ( | F && | f | ) |
| U * swoc::MemSpan< void >::as_ptr | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
| void & swoc::MemSpan< void >::back | ( | ) |
|
constexpr |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inline |
|
inlineconstexpr |
| void swoc::MemSpan< void >::destroy | ( | ) |
|
inlineconstexpr |
|
constexpr |
|
constexpr |
| void & swoc::MemSpan< void >::front | ( | ) |
|
inline |
|
constexpr |
|
inlineconstexpr |
| self_type & swoc::MemSpan< void >::make | ( | Args &&... | args | ) |
Construct all elements in the span.
For each element in the span, construct an instance of the span type using the args. If the instances need destruction this must be done explicitly.
| auto swoc::MemSpan< void >::make | ( | Args &&... | args | ) | -> self_type & |
| auto swoc::MemSpan< void >::make | ( | Args &&... | args | ) | -> self_type & |
|
inlineexplicit |
|
inline |
|
inlineconstexpr |
| self_type & swoc::MemSpan< void >::operator= | ( | MemSpan< U > const & | that | ) |
Assignment - the span is copied, not the content. Any type of MemSpan can be assigned to MemSpan<void>.
| auto swoc::MemSpan< void >::operator= | ( | MemSpan< U > const & | that | ) | -> self_type & |
|
inlineconstexprdefault |
|
inlineconstexpr |
| void & swoc::MemSpan< void >::operator[] | ( | size_t | idx | ) | const |
|
inlineconstexpr |
|
inline |
| MemSpan< U > swoc::MemSpan< U >::rebind | ( | ) | const |
Make a copy of this span on the same memory but of type U.
| U | Type for the created span. |
MemSpan which contains the same memory as instances of U.if no type is specified, the default is void or void const according to whether value_type is const.
| MemSpan< U > swoc::MemSpan< void >::rebind | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
constexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Return a sub span of this span.
| offset | Offset (index) of first element in subspan. |
| count | Number of elements in the subspan. |
The result is clipped by this - if offset is out of range an empty span is returned. Otherwise count is clipped by the number of elements available in this.
|
inlineconstexpr |
Return a sub span of this span.
| offset | Offset (index) of first element. |
| n | Number of elements. |
The result is clipped by this - if offset is out of range an empty span is returned. Otherwise count is clipped by the number of elements available in this. In effect the intersection of the span described by ( offset , count ) and this span is returned, which may be the empty span.
|
inlineconstexpr |
|
inline |
|
protected |
|
protected |