OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine::byteset< N > Class Template Reference

Class storing a sequence of bytes converting them to and from unsigned integer. More...

#include <eagine/byteset.hpp>

Public Types

using size_type = span_size_t
 Alias for size type.
 
using value_type = byte
 Alias for element value type.
 
using reference = value_type &
 Alias for element reference type.
 
using const_reference = const value_type &
 Alias for const reference type.
 
using pointer = value_type *
 Alias for pointer to element type.
 
using const_pointer = const value_type *
 Alias for pointer to const element type.
 
using iterator = value_type *
 Alias for iterator type.
 
using const_iterator = const value_type *
 Alias for const iterator type.
 

Public Member Functions

constexpr byteset () noexcept=default
 Default constructor.
 
template<typename... B, typename = std::enable_if_t< (sizeof...(B) == N) && (sizeof...(B) != 0) && std::conjunction_v<std::true_type, std::is_convertible<B, value_type>...>>>
constexpr byteset (B... b) noexcept
 Construction from a pack of integer values.
 
template<typename UInt , typename = std::enable_if_t< (sizeof(UInt) >= N) && std::is_integral_v<UInt> && std::is_unsigned_v<UInt>>>
constexpr byteset (UInt init) noexcept
 Construiction from unsigned integer that is then split into bytes.
 
auto data () noexcept -> pointer
 Returns a pointer to the byte sequence start. More...
 
constexpr auto data () const noexcept -> const_pointer
 Returns a const pointer to the byte sequence start. More...
 
constexpr auto size () const noexcept -> size_type
 Returns the count of bytes in the stored sequence.
 
constexpr auto block () const noexcept -> memory::const_block
 Creates a const view over the stored sequence of bytes.
 
constexpr auto operator[] (size_type i) noexcept -> reference
 Subscript operator.
 
constexpr auto operator[] (size_type i) const noexcept -> const_reference
 Subscript operator.
 
constexpr auto front () noexcept -> reference
 Returns the first byte in the sequence. More...
 
constexpr auto front () const noexcept -> const_reference
 Returns the first byte in the sequence. More...
 
constexpr auto back () noexcept -> reference
 Returns the last byte in the sequence. More...
 
constexpr auto back () const noexcept -> const_reference
 Returns the last byte in the sequence. More...
 
auto begin () noexcept -> iterator
 Returns an iterator to the start of the byte sequence.
 
auto end () noexcept -> iterator
 Returns an iterator past the end of the byte sequence.
 
constexpr auto begin () const noexcept -> const_iterator
 Returns a const iterator to the start of the byte sequence.
 
constexpr auto end () const noexcept -> const_iterator
 Returns a const iterator past the end of the byte sequence.
 
template<typename UInt , typename = std::enable_if_t< (sizeof(UInt) >= N) && ( std::is_same_v<UInt, __uint128_t> || std::is_same_v<UInt, __int128_t> || std::is_integral_v<UInt>)>>
constexpr auto as (UInt i=0) const noexcept
 Converts the byte sequence into an unsigned integer value.
 

Friends

constexpr friend auto operator== (const byteset &a, const byteset &b) noexcept
 Equality comparison.
 
constexpr friend auto operator!= (const byteset &a, const byteset &b) noexcept
 Non-equality comparison.
 
constexpr friend auto operator< (const byteset &a, const byteset &b) noexcept
 Less-than comparison.
 
constexpr friend auto operator<= (const byteset &a, const byteset &b) noexcept
 Less-equal comparison.
 
constexpr friend auto operator> (const byteset &a, const byteset &b) noexcept
 Greater-than comparison.
 
constexpr friend auto operator>= (const byteset &a, const byteset &b) noexcept
 Greater-equal comparison.
 

Detailed Description

template<std::size_t N>
class eagine::byteset< N >

Class storing a sequence of bytes converting them to and from unsigned integer.

Template Parameters
Nthe size - number of elements - in the byte sequence.
See also
biteset

Member Function Documentation

◆ back() [1/2]

template<std::size_t N>
constexpr auto eagine::byteset< N >::back ( ) const -> const_reference
inlineconstexprnoexcept

Returns the last byte in the sequence.

See also
front

◆ back() [2/2]

template<std::size_t N>
constexpr auto eagine::byteset< N >::back ( ) -> reference
inlineconstexprnoexcept

Returns the last byte in the sequence.

See also
front

◆ data() [1/2]

template<std::size_t N>
constexpr auto eagine::byteset< N >::data ( ) const -> const_pointer
inlineconstexprnoexcept

Returns a const pointer to the byte sequence start.

See also
size

◆ data() [2/2]

template<std::size_t N>
auto eagine::byteset< N >::data ( ) -> pointer
inlinenoexcept

Returns a pointer to the byte sequence start.

See also
size

Referenced by eagine::byteset< store_size >::block().

◆ front() [1/2]

template<std::size_t N>
constexpr auto eagine::byteset< N >::front ( ) const -> const_reference
inlineconstexprnoexcept

Returns the first byte in the sequence.

See also
back

◆ front() [2/2]

template<std::size_t N>
constexpr auto eagine::byteset< N >::front ( ) -> reference
inlineconstexprnoexcept

Returns the first byte in the sequence.

See also
back

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

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).