Skip to content
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

Remove use of auto in introductory examples #85

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/charconv/overview.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ This library requires a minimum of C++11.

const char* buffer = "42";
int v = 0;
auto r = boost::charconv::from_chars(buffer, buffer + std::strlen(buffer), v);
boost::charconv::from_chars_result r = boost::charconv::from_chars(buffer, buffer + std::strlen(buffer), v);
assert(r.ec == std::errc());
assert(v == 42);

char buffer[64];
int v = 123456;
auto r = boost::charconv::to_chars(buffer, buffer + sizeof(buffer) - 1, v);
boost::charconv:to_chars_result r = boost::charconv::to_chars(buffer, buffer + sizeof(buffer) - 1, v);
assert(r.ec == std::errc());
assert(!strncmp(buffer, "123456", 6)); // Strncmp returns 0 on match

Expand All @@ -46,4 +46,4 @@ Tested on https://github.com/cppalliance/charconv/actions[Github Actions] and ht
Currently only https://en.cppreference.com/w/cpp/compiler_support/17[GCC 11+ and MSVC 19.24+] support both integer and floating-point conversions in their implementation of `<charconv>`. +

If you are using either of those compilers, Boost.Charconv is at least as performant as `<charconv>`, and can be up to several times faster.
See: <<Benchmarks>>
See: <<Benchmarks>>