UNISTDX_NET_BYTES
template <class T, class Ch = char>
union sys::bytes

Container, that uses object binary representation as its contents.

T
object type

Ch
character (byte) type

Types
  • using size_type = std::size_t

    Size type.

  • using iterator = value_type *

    Iterator type.

  • using value_type = Ch

    Character (byte) type.

  • using object_type = T

    Object type.

Fields
  • const typedef value_type * const_iterator

    Constant iterator.

Methods
  • size() -> constexpr size_type

    Get the number of bytes.

  • clear() -> void

    Fill with noughts.

  • value() -> object_type &

    Get object.

  • value() const -> constexpr const object_type &

    Get object.

  • back() -> value_type &

    Get the last byte.

  • front() -> value_type &

    Get the first byte.

  • end() const -> constexpr const_iterator

    Get iterator to the end of the byte sequence.

  • end() -> iterator

    Get iterator to the end of the byte sequence.

  • begin() const -> constexpr const_iterator

    Get iterator to the beginning of the byte sequence.

  • begin() -> iterator

    Get iterator to the beginning of the byte sequence.

  • data() const -> const_iterator

    Get pointer to the first byte.

  • data() -> iterator

    Get pointer to the first byte.

  • operator!=(const bytes & rhs) const -> constexpr bool

    Byte-wise compare.

  • operator==(const bytes & rhs) const -> constexpr bool

    Byte-wise compare.

  • operator[](size_type idx) -> value_type &

    Access a byte by index.

  • operator[](size_type idx) const -> constexpr value_type

    Access a byte by index.

  • operator const object_type &() const -> constexpr

    Automatically cast to value type.

  • operator object_type &()

    Automatically cast to value type.

  • to_host_format() -> void

    Convert binary representation to native byte order in-place.

  • to_network_format() -> void

    Convert binary representation to network byte order in-place.

  • swap() -> void

    Swap (reverse) byte order in-place.

  • template <class It>
    bytes(It first, size_type n)

    Construct bytes container from byte sequence described by iterator first and sequence size n.

  • template <class It>
    bytes(It first, It last)

    Construct bytes container from byte sequence described by two iterators.

  • bytes(object_type rhs) -> constexpr

    Construct bytes container using rhs binary representaton as its contents.

  • bytes(const bytes & rhs) -> constexpr

    Copy-constructor.

  • bytes() -> constexpr
template <class T>
make_bytes(T rhs) -> constexpr bytes< T >

Construct byte sequence from object rhs.

template <class T, class B>
operator<<(std::ostream & out, const bytes< T, B > & rhs) -> std::ostream &

Print byte sequence in hexadecimal form.