I'm attempting to use std::byte
for the first time but I'm failing to initialize the value.
#include <cstddef>
double red_double = 0.5;
auto red_byte = std::byte(red_double * 255);
Results in: error C2440: '<function-style-cast>': cannot convert from 'double' to 'std::byte'
This seems like a mind-numbingly simple task but I guess std::byte works differently to normal types. Any help would be appreciated!
I'm compiling with MSVC 19.22 which apparently claims to fully support std::byte: https://learn.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance?view=vs-2019