I have 2 functions to read binary file.
1st function reads sizeof(T)
bytes from file:
template
T read() { ... some IO
C++ does not specify the order in which a function's arguments are evaluated. If the expressions to a function all consume data from a stream, you can get behavior where objects are read in the wrong order.
Braced initializer lists are evaluated from left to right, however, so you should get better results if you try something like:
template
std::tuple read_all() {
return std::tuple{read()...};
}