Botan 3.9.0
Crypto and TLS for C&
Botan::StrongSpan< T > Class Template Reference

#include <strong_type.h>

Public Types

using const_pointer = typename underlying_span::const_pointer
using iterator = typename underlying_span::iterator
using pointer = typename underlying_span::pointer
using size_type = typename underlying_span::size_type
using value_type = typename underlying_span::value_type

Public Member Functions

decltype(auto) begin () const noexcept(noexcept(this->m_span.begin()))
decltype(auto) begin () noexcept(noexcept(this->m_span.begin()))
decltype(auto) data () const noexcept(noexcept(this->m_span.data()))
decltype(auto) data () noexcept(noexcept(this->m_span.data()))
bool empty () const noexcept(noexcept(this->m_span.empty()))
decltype(auto) end () const noexcept(noexcept(this->m_span.end()))
decltype(auto) end () noexcept(noexcept(this->m_span.end()))
underlying_span get ()
underlying_span get () const
StrongSpanoperator= (const StrongSpan &other)=default
StrongSpanoperator= (StrongSpan &&other)=default
decltype(auto) operator[] (typename underlying_span::size_type i) const noexcept
decltype(auto) size () const noexcept(noexcept(this->m_span.size()))
 StrongSpan ()=default
 StrongSpan (const StrongSpan &other)=default
template<concepts::contiguous_strong_type T2>
requires (std::is_same_v<T2, std::remove_const_t<T>>)
 StrongSpan (const StrongSpan< T2 > &other)
 StrongSpan (StrongSpan &&other)=default
 StrongSpan (T &strong)
 StrongSpan (underlying_span span)
 ~StrongSpan ()=default

Detailed Description

template<concepts::contiguous_strong_type T>
class Botan::StrongSpan< T >

This mimmicks a std::span but keeps track of the strong-type information. Use this when you would want to use const Strong<...>& as a parameter declaration. In particular this allows assigning strong-type information to slices of a bigger buffer without copying the bytes. E.g:

using Foo = Strong<std::vector<uint8_t>, Foo_>;

void bar(StrongSpan<Foo> foo) { ... }

std::vector<uint8_t> buffer; BufferSlicer slicer(buffer); bar(slicer.take<Foo>()); // This does not copy the data from buffer but // just annotates the 'Foo' strong-type info.

Definition at line 640 of file strong_type.h.

Member Typedef Documentation

◆ const_pointer

template<concepts::contiguous_strong_type T>
using Botan::StrongSpan< T >::const_pointer = typename underlying_span::const_pointer

Definition at line 649 of file strong_type.h.

◆ iterator

template<concepts::contiguous_strong_type T>
using Botan::StrongSpan< T >::iterator = typename underlying_span::iterator

Definition at line 647 of file strong_type.h.

◆ pointer

template<concepts::contiguous_strong_type T>
using Botan::StrongSpan< T >::pointer = typename underlying_span::pointer

Definition at line 648 of file strong_type.h.

◆ size_type

template<concepts::contiguous_strong_type T>
using Botan::StrongSpan< T >::size_type = typename underlying_span::size_type

Definition at line 646 of file strong_type.h.

◆ value_type

template<concepts::contiguous_strong_type T>
using Botan::StrongSpan< T >::value_type = typename underlying_span::value_type

Definition at line 645 of file strong_type.h.

Constructor & Destructor Documentation

◆ StrongSpan() [1/6]

template<concepts::contiguous_strong_type T>
Botan::StrongSpan< T >::StrongSpan ( )
default

◆ StrongSpan() [2/6]

template<concepts::contiguous_strong_type T>
Botan::StrongSpan< T >::StrongSpan ( underlying_span span)
inlineexplicit

Definition at line 653 of file strong_type.h.

653: m_span(span) {}

◆ StrongSpan() [3/6]

template<concepts::contiguous_strong_type T>
Botan::StrongSpan< T >::StrongSpan ( T & strong)
inline

Definition at line 656 of file strong_type.h.

656: m_span(strong) {}

◆ StrongSpan() [4/6]

template<concepts::contiguous_strong_type T>
template<concepts::contiguous_strong_type T2>
requires (std::is_same_v<T2, std::remove_const_t<T>>)
Botan::StrongSpan< T >::StrongSpan ( const StrongSpan< T2 > & other)
inline

Definition at line 670 of file strong_type.h.

672 : m_span(other.get()) {}
underlying_span get() const

References get(), and StrongSpan().

◆ StrongSpan() [5/6]

template<concepts::contiguous_strong_type T>
Botan::StrongSpan< T >::StrongSpan ( const StrongSpan< T > & other)
default

References StrongSpan().

◆ StrongSpan() [6/6]

template<concepts::contiguous_strong_type T>
Botan::StrongSpan< T >::StrongSpan ( StrongSpan< T > && other)
default

References StrongSpan().

◆ ~StrongSpan()

template<concepts::contiguous_strong_type T>
Botan::StrongSpan< T >::~StrongSpan ( )
default

Member Function Documentation

◆ begin() [1/2]

template<concepts::contiguous_strong_type T>
decltype(auto) Botan::StrongSpan< T >::begin ( ) const
inlinenoexcept

Definition at line 701 of file strong_type.h.

701{ return this->m_span.begin(); }

References begin().

◆ begin() [2/2]

template<concepts::contiguous_strong_type T>
decltype(auto) Botan::StrongSpan< T >::begin ( )
inlinenoexcept

Definition at line 699 of file strong_type.h.

699{ return this->m_span.begin(); }

References begin().

Referenced by begin(), begin(), Botan::Classic_McEliece_KeyPair_Internal::generate(), and Botan::Sphincs_Hash_Functions_Sha2::PRF_msg().

◆ data() [1/2]

template<concepts::contiguous_strong_type T>
decltype(auto) Botan::StrongSpan< T >::data ( ) const
inlinenoexcept

Definition at line 693 of file strong_type.h.

693{ return this->m_span.data(); }

◆ data() [2/2]

template<concepts::contiguous_strong_type T>
decltype(auto) Botan::StrongSpan< T >::data ( )
inlinenoexcept

◆ empty()

template<concepts::contiguous_strong_type T>
bool Botan::StrongSpan< T >::empty ( ) const
inlinenoexcept

Definition at line 697 of file strong_type.h.

697{ return this->m_span.empty(); }

References empty().

Referenced by empty().

◆ end() [1/2]

template<concepts::contiguous_strong_type T>
decltype(auto) Botan::StrongSpan< T >::end ( ) const
inlinenoexcept

Definition at line 705 of file strong_type.h.

705{ return this->m_span.end(); }

References end().

◆ end() [2/2]

template<concepts::contiguous_strong_type T>
decltype(auto) Botan::StrongSpan< T >::end ( )
inlinenoexcept

Definition at line 703 of file strong_type.h.

703{ return this->m_span.end(); }

References end().

Referenced by end(), end(), and Botan::Classic_McEliece_KeyPair_Internal::generate().

◆ get() [1/2]

template<concepts::contiguous_strong_type T>
underlying_span Botan::StrongSpan< T >::get ( )
inline
Returns
the underlying std::span without any type constraints

Definition at line 689 of file strong_type.h.

689{ return m_span; }

◆ get() [2/2]

template<concepts::contiguous_strong_type T>
underlying_span Botan::StrongSpan< T >::get ( ) const
inline
Returns
the underlying std::span without any type constraints

Definition at line 684 of file strong_type.h.

684{ return m_span; }

Referenced by StrongSpan(), and Botan::treehash().

◆ operator=() [1/2]

template<concepts::contiguous_strong_type T>
StrongSpan & Botan::StrongSpan< T >::operator= ( const StrongSpan< T > & other)
default

References StrongSpan().

◆ operator=() [2/2]

template<concepts::contiguous_strong_type T>
StrongSpan & Botan::StrongSpan< T >::operator= ( StrongSpan< T > && other)
default

References StrongSpan().

◆ operator[]()

template<concepts::contiguous_strong_type T>
decltype(auto) Botan::StrongSpan< T >::operator[] ( typename underlying_span::size_type i) const
inlinenoexcept

Definition at line 707 of file strong_type.h.

707{ return this->m_span[i]; }

◆ size()


The documentation for this class was generated from the following file: