-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't write into a pre-existing buffer?? #122
Comments
It has been discussed in Issue #105. If you have control over allocation of this region of memory I recommend replacing manual allocation with Currently the base Buffer class is internal, but if you like I can make it public and, possibly provide a more convenient API for this. PS Good idea, I'll probably open a Google Group. Until then it's fine to post questions as issues. |
Thanks very much I'd vote for FixedBuffer and FixedWriter to be part of the library. Seems a simple and elegant solution? |
Sure, I'll include |
OK, here you go: http://cppformat.readthedocs.org/en/latest/reference.html#fmt::BasicArrayWriter. I've decided to call the class Example:
|
Nice work Would you take a submission that adds fmt::ArrayWriter::advance(int offset); both of which throw if you attempt to move outside the bounds of the buffer Justification:In practice there may also be non-cppformat activity on the e.g. I'm creating a C++ lib to do the work of 'statsd' and create regular On 2 March 2015 at 02:33, Victor Zverovich [email protected] wrote:
|
Thanks. I'd rather not allow direct manipulation of the underlying buffer, because it doesn't fit very well into the
This uses Another option is to only construct |
@mintyc Will it work for you? |
I'm just reworking some code to use your preferred approach, so yes. I Its not ideal for amending stats values inplace in the buffer (rather than You have been incredibly helpful. Thank you very much On 2 March 2015 at 15:19, Victor Zverovich [email protected] wrote:
|
Great. Thanks for the feedback. |
HI @vitaut
Why |
Hi @KindDragon,
|
If I have a pre-allocated region of memory I can't find an API that allows me to write directly into it without a memcpy as well (e.g. from a returned string)
Am I missing something?
Seems like a problem for high performance, so given your fantastic benchmark numbers I'm pretty sure it is me that is missing something!
PS Maybe start a forum or discussion area for points like this?
The text was updated successfully, but these errors were encountered: