Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
Classes | Macros | Functions
span.h File Reference
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <type_traits>
Include dependency graph for span.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Span< C >
 A Span is an object that can refer to a contiguous sequence of objects. More...
 
struct  Span< C >::is_Span_int< T >
 
struct  Span< C >::is_Span_int< Span< T > >
 
struct  Span< C >::is_Span< T >
 

Macros

#define CONSTEXPR_IF_NOT_DEBUG   constexpr
 
#define ASSERT_IF_DEBUG(x)
 
#define SPAN_ATTR_LIFETIMEBOUND
 

Functions

template<typename T , typename EndOrSize >
 Span (T *, EndOrSize) -> Span< T >
 
template<typename T , std::size_t N>
 Span (T(&)[N]) -> Span< T >
 
template<typename T >
 Span (T &&) -> Span< std::enable_if_t< !std::is_lvalue_reference_v< T >, const std::remove_pointer_t< decltype(std::declval< T && >().data())> > >
 
template<typename T >
 Span (T &) -> Span< std::remove_pointer_t< decltype(std::declval< T & >().data())> >
 
template<typename T >
T & SpanPopBack (Span< T > &span)
 Pop the last element off a span, and return a reference to that element.
 
const std::byteBytePtr (const void *data)
 Convert a data pointer to a std::byte data pointer.
 
std::byteBytePtr (void *data)
 
template<typename T >
Span< const std::byteAsBytes (Span< T > s) noexcept
 
template<typename T >
Span< std::byteAsWritableBytes (Span< T > s) noexcept
 
template<typename V >
Span< const std::byteMakeByteSpan (V &&v) noexcept
 
template<typename V >
Span< std::byteMakeWritableByteSpan (V &&v) noexcept
 
uint8_tUCharCast (char *c)
 
uint8_tUCharCast (uint8_t *c)
 
const uint8_tUCharCast (const char *c)
 
const uint8_tUCharCast (const uint8_t *c)
 
const uint8_tUCharCast (const std::byte *c)
 
template<typename T >
constexpr auto UCharSpanCast (Span< T > s) -> Span< typename std::remove_pointer< decltype(UCharCast(s.data()))>::type >
 
template<typename V >
constexpr auto MakeUCharSpan (V &&v) -> decltype(UCharSpanCast(Span{std::forward< V >(v)}))
 Like the Span constructor, but for (const) uint8_t member types only.
 

Macro Definition Documentation

◆ ASSERT_IF_DEBUG

#define ASSERT_IF_DEBUG (   x)

Definition at line 19 of file span.h.

◆ CONSTEXPR_IF_NOT_DEBUG

#define CONSTEXPR_IF_NOT_DEBUG   constexpr

Definition at line 18 of file span.h.

◆ SPAN_ATTR_LIFETIMEBOUND

#define SPAN_ATTR_LIFETIMEBOUND

Definition at line 29 of file span.h.

Function Documentation

◆ AsBytes()

template<typename T >
Span< const std::byte > AsBytes ( Span< T >  s)
noexcept

Definition at line 294 of file span.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AsWritableBytes()

template<typename T >
Span< std::byte > AsWritableBytes ( Span< T >  s)
noexcept

Definition at line 297 of file span.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BytePtr() [1/2]

const std::byte * BytePtr ( const void data)
inline

Convert a data pointer to a std::byte data pointer.

Where possible, please use the safer AsBytes helpers.

Definition at line 286 of file span.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BytePtr() [2/2]

std::byte * BytePtr ( void data)
inline

Definition at line 289 of file span.h.

Here is the call graph for this function:

◆ MakeByteSpan()

template<typename V >
Span< const std::byte > MakeByteSpan ( V &&  v)
noexcept

Definition at line 301 of file span.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MakeUCharSpan()

template<typename V >
constexpr auto MakeUCharSpan ( V &&  v) -> decltype(UCharSpanCast(Span{std::forward<V>(v)}))
constexpr

Like the Span constructor, but for (const) uint8_t member types only.

Only works for (un)signed char containers.

Definition at line 337 of file span.h.

Here is the caller graph for this function:

◆ MakeWritableByteSpan()

template<typename V >
Span< std::byte > MakeWritableByteSpan ( V &&  v)
noexcept

Definition at line 304 of file span.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Span() [1/4]

template<typename T >
Span ( T &&  ) -> Span< std::enable_if_t< !std::is_lvalue_reference_v< T >, const std::remove_pointer_t< decltype(std::declval< T && >().data())> > >

◆ Span() [2/4]

template<typename T >
Span ( T &  ) -> Span< std::remove_pointer_t< decltype(std::declval< T & >().data())> >

◆ Span() [3/4]

template<typename T , typename EndOrSize >
Span ( T *  ,
EndOrSize   
) -> Span< T >

◆ Span() [4/4]

template<typename T , std::size_t N>
Span ( T(&)  [N]) -> Span< T >

◆ SpanPopBack()

template<typename T >
T & SpanPopBack ( Span< T > &  span)

Pop the last element off a span, and return a reference to that element.

Definition at line 276 of file span.h.

Here is the call graph for this function:

◆ UCharCast() [1/5]

uint8_t * UCharCast ( char c)
inline

Definition at line 309 of file span.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UCharCast() [2/5]

const uint8_t * UCharCast ( const char c)
inline

Definition at line 315 of file span.h.

Here is the call graph for this function:

◆ UCharCast() [3/5]

const uint8_t * UCharCast ( const std::byte c)
inline

Definition at line 321 of file span.h.

Here is the call graph for this function:

◆ UCharCast() [4/5]

const uint8_t * UCharCast ( const uint8_t c)
inline

Definition at line 318 of file span.h.

Here is the call graph for this function:

◆ UCharCast() [5/5]

uint8_t * UCharCast ( uint8_t c)
inline

Definition at line 312 of file span.h.

Here is the call graph for this function:

◆ UCharSpanCast()

template<typename T >
constexpr auto UCharSpanCast ( Span< T >  s) -> Span<typename std::remove_pointer<decltype(UCharCast(s.data()))>::type>
constexpr

Definition at line 327 of file span.h.

Here is the call graph for this function: