diff --git a/fmt/format.h b/fmt/format.h index 127c2262..b8713978 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -494,14 +494,11 @@ class BasicStringRef { /** \rst - Converts a string reference to a ``std::basic_string`` object. + Converts a string reference to an ``std::string`` object. \endrst */ - template > - std::basic_string, Allocator> - to_string(const Allocator &allocator = Allocator()) const { - return std::basic_string, Allocator>( - data_, size_, allocator); + std::basic_string to_string() const { + return std::basic_string(data_, size_); } /** Returns a pointer to the string data. */ @@ -2576,14 +2573,11 @@ class BasicWriter { /** \rst - Returns the content of the output buffer as a `std::basic_string`. + Returns the content of the output buffer as an `std::string`. \endrst */ - template > - std::basic_string, Allocator> str( - const Allocator &allocator = Allocator()) const { - return std::basic_string, Allocator>( - &buffer_[0], buffer_.size(), allocator); + std::basic_string str() const { + return std::basic_string(&buffer_[0], buffer_.size()); } /** diff --git a/fmt/string.h b/fmt/string.h index bf048218..ccf46ee1 100644 --- a/fmt/string.h +++ b/fmt/string.h @@ -20,10 +20,10 @@ namespace internal { template > class StringBuffer : public Buffer { public: - typedef std::basic_string, Allocator> string_type; + typedef std::basic_string, Allocator> StringType; private: - string_type data_; + StringType data_; protected: virtual void grow(std::size_t size) FMT_OVERRIDE { @@ -37,7 +37,7 @@ class StringBuffer : public Buffer { : data_(allocator) {} // Moves the data to ``str`` clearing the buffer. - void move_to(string_type &str) { + void move_to(StringType &str) { data_.resize(this->size_); str.swap(data_); this->capacity_ = this->size_ = 0; @@ -49,7 +49,7 @@ class StringBuffer : public Buffer { /** \rst This class template provides operations for formatting and writing data - into a character stream. The output is stored in ``std::basic_string`` + into a character stream. The output is stored in a ``std::basic_string`` that grows dynamically. You can use one of the following typedefs for common character types