|
Utility Rack
|
Utility functions to construct and compare a std::array of std::byte objects.
More...
#include <array>#include <cstddef>#include <utility>

Go to the source code of this file.
Utility functions to construct and compare a std::array of std::byte objects.
A std::byte is defined as an enum and there are no implicit conversions from int to an enum class. Instead of writing:
it is easier (specially for larger arrays) to write:
The make_byte_array function is taken from an example by Blitz Rakete on Stackoverflow (Blitz is user Rakete1111 on SO). The static_cast was added to eliminate "narrowing" warnings (since typically integer values are used to initialize the std::byte values, which would be a narrowing conversion).
The compare_byte_arrays function simplifies test code, typically using the Catch2 unit test library.
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)