I wanted to see if it is safe to reintpret_cast a colour struct into an unsigned char* to pass around for APIs
struct Colour {
unsigned char r,g,b,a;
};
static_assert(sizeof(Colour) == sizeof(unsigned char[4]) && std::has_unique_object_representation_v<Colour> && std::is_trivially_copyable_v<T>,"No padding,unique representioation,trivial to copy via memcpy");
is this valid and not UB by the standard
Colour colour{4,2,2,1};
somelowlevelapiexpectingrgbavalyesviaapointer(reinterpret_cast<unsigned char*>(&colour));