C++ Logo


Advanced search

Subject: Re: [std-proposals] Modern std::byte stream IO for C++
From: Lyberta (lyberta_at_[hidden])
Date: 2020-03-05 14:28:47

Ryan Nicholl:
> Suggestion: Read and write should not be added as member functions, but as trait specializations.
> Reason: Adding serialization points for third party code.
> I did this in my rpnx::serial_traits library. It worked pretty well and allowed me to define partial specializations for e.g. std::map<K, V> where K and V also has serial specializations. This was an iterator based library (just reads/writes from iterators instead of "memory" or "files").

Can this be solved with non-member approach that this paper also introduces? Although I would argue that standard containers
shouldn't have default way of serialization.

Instead of custom traits you can pass customization point object around, the default being std::io::read or std::io::write.

STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups