
Daniel James wrote:
But, whether you use std::string, std::vector, or manually manage memory, it should be an implementation detail.
Exactly. We will probably go for std::vector for now, but since it is an implementation detail, changing this at a later time should not be a problem. (As long as it is found worthy of the effort in terms of efficiency that is) The
binary representation should probably be exposed by its iterators, not the std::string. i.e. instead of get_binary_layout(), have:
binary_iterator binary_begin(); binary_iterator binary_end(); const_binary_iterator binary_begin() const; const_binary_iterator binary_end() const;
Should you have non-const binary iterators? IMO, yes, anyone who uses them should know what they're letting themselves in for.
Although, you might want to guarantee that the binary representation is in continuous memory, and isn't, say, a deque.
I have problems finding any reason why anyone would need to have access to the binary representation. To me it seems anything lower level than code points, would never be needed. Unless of course you are processing Unicode encoding forms manually, but if you are doing that, why are you using a unicode library anyway? A simple vector with code units would be much more appropriate. - Erik