I am working on a custom file streambuf
. Now, I want to flush on seek like fstream
does. At this point I want to know how big the array for output of std::codecvt::unshift()
should be? It seems to me that the size returned by std::codecvt::max_length()
should be enough. Is my assumption right?
Asked
Active
Viewed 96 times
0

wilx
- 17,697
- 6
- 59
- 114
-
From the article you cite: "No more than `to_end-to` characters are written." Is this not sufficient? – Igor Tandetnik Oct 10 '13 at 13:07
-
@IgorTandetnik: It is sufficient not to overwrite memory beyond my supplied buffer. But I want to know the size in advance so that I can avoid having to loop if my provided buffer is not big enough. – wilx Oct 10 '13 at 13:36
-
I don't understand. Why do you think there is some sort of required size for `unshift`? – David G Oct 28 '13 at 01:31
-
@0x499602D2: Because there seems to be a problem if the buffer is not big enough to store whole multi-byte sequence. See my other question related to this which describes problems with the `out()` function: http://stackoverflow.com/questions/19357027/trouble-with-stdcodecvt-utf8-facet – wilx Oct 28 '13 at 11:07