Код: Выделить всё
template
std::ostream& raw_write(std::ostream& os, T& val, size_t size = sizeof(val)) {
return os.write(reinterpret_cast(&val), size);
}
Код: Выделить всё
(5): error C2065: 'val': undeclared identifierВот демо.
Эта версия работает правильно:
Код: Выделить всё
template
std::ostream& raw_write(std::ostream& os, T& val, size_t size = sizeof(T)) {
return os.write(reinterpret_cast(&val), size);
}
Подробнее здесь: https://stackoverflow.com/questions/798 ... ault-value
Мобильная версия