Commit a66c2259 authored by Adam Simpkins's avatar Adam Simpkins Committed by Sara Golemon

add additional formatChecked() and vformatChecked() wrappers

Summary:
Add wrapper functions for directly appending to a string, similar to the
existing format() and vformat() wrappers.

Test Plan:
Converted some existing code using these format() and vformat() wrappers
to use formatChecked() and vformatChecked().

Reviewed By: jon.coens@fb.com

FB internal diff: D1151496

@override-unit-failures
parent b844acfb
......@@ -271,6 +271,12 @@ format(Str* out, StringPiece fmt, Args&&... args) {
format(fmt, std::forward<Args>(args)...).appendTo(*out);
}
template <class Str, class... Args>
typename std::enable_if<IsSomeString<Str>::value>::type
formatChecked(Str* out, StringPiece fmt, Args&&... args) {
formatChecked(fmt, std::forward<Args>(args)...).appendTo(*out);
}
/**
* Append vformatted output to a string.
*/
......@@ -280,6 +286,12 @@ vformat(Str* out, StringPiece fmt, Container&& container) {
vformat(fmt, std::forward<Container>(container)).appendTo(*out);
}
template <class Str, class Container>
typename std::enable_if<IsSomeString<Str>::value>::type
vformatChecked(Str* out, StringPiece fmt, Container&& container) {
vformatChecked(fmt, std::forward<Container>(container)).appendTo(*out);
}
/**
* Utilities for all format value specializations.
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment