I have 2 functions to read binary file.
1st function reads sizeof(T) bytes from file:
sizeof(T)
template T read() { ... some IO
I would keep it a bit simpler and do this:
uint32_t a; uint8_t b; std::tie(a, b) = read>();
This way there's only a single read() and you can even skip the tie() if you use the tuple (or struct) fields directly.
read()
tie()