mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 21:16:56 +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.
|
||||
\endrst
|
||||
*/
|
||||
operator std::basic_string<Char>() const {
|
||||
std::basic_string<Char> to_string() const {
|
||||
return std::basic_string<Char>(data_, size());
|
||||
}
|
||||
|
||||
|
@ -1450,7 +1450,7 @@ TEST(StringRefTest, Ctor) {
|
||||
}
|
||||
|
||||
TEST(StringRefTest, ConvertToString) {
|
||||
std::string s = StringRef("abc");
|
||||
std::string s = StringRef("abc").to_string();
|
||||
EXPECT_EQ("abc", s);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ const unsigned BIG_NUM = INT_MAX + 1u;
|
||||
|
||||
// Makes format string argument positional.
|
||||
std::string make_positional(fmt::StringRef format) {
|
||||
std::string s(format);
|
||||
std::string s(format.to_string());
|
||||
s.replace(s.find('%'), 1, "%1$");
|
||||
return s;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user