mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-26 12:35:32 +00:00
Replace implicit conversion to std::string with to_string
This commit is contained in:
parent
147e5ebbbc
commit
e39490500c
2
format.h
2
format.h
@ -257,7 +257,7 @@ class BasicStringRef {
|
|||||||
Converts a string reference to an ``std::string`` object.
|
Converts a string reference to an ``std::string`` object.
|
||||||
\endrst
|
\endrst
|
||||||
*/
|
*/
|
||||||
operator std::basic_string<Char>() const {
|
std::basic_string<Char> to_string() const {
|
||||||
return std::basic_string<Char>(data_, size());
|
return std::basic_string<Char>(data_, size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1450,7 +1450,7 @@ TEST(StringRefTest, Ctor) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(StringRefTest, ConvertToString) {
|
TEST(StringRefTest, ConvertToString) {
|
||||||
std::string s = StringRef("abc");
|
std::string s = StringRef("abc").to_string();
|
||||||
EXPECT_EQ("abc", s);
|
EXPECT_EQ("abc", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ const unsigned BIG_NUM = INT_MAX + 1u;
|
|||||||
|
|
||||||
// Makes format string argument positional.
|
// Makes format string argument positional.
|
||||||
std::string make_positional(fmt::StringRef format) {
|
std::string make_positional(fmt::StringRef format) {
|
||||||
std::string s(format);
|
std::string s(format.to_string());
|
||||||
s.replace(s.find('%'), 1, "%1$");
|
s.replace(s.find('%'), 1, "%1$");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user