Safely wraps StrFormat() captures of %n conversions into an integer value.
Declared in <absl/strings/str_format.h>
class FormatCountCapture;
%n conversions denote the number of characters written by a formatting operation to this point.
This wrapper is designed to allow safe usage of %n within `StrFormat(); in the printf() family of functions, %n is not safe to use, as the int * buffer can be used to capture arbitrary data.
Example:
int n = 0; std::string s = absl::StrFormat("%s%d%n", "hello", 123, absl::FormatCountCapture(&n)); EXPECT_EQ(8, n);
| Name | Description |
|---|---|
FormatCountCapture [constructor] | Constructs a capture that writes the character count to p. |
| Name | Description |
|---|---|
absl::str_format_internal::FormatCountCaptureHelper |