Minor corrections.

This commit is contained in:
Victor Zverovich 2013-09-08 13:47:38 -07:00
parent 563a575c0c
commit e89c60d63e

View File

@ -27,7 +27,8 @@ Features
* Reliability: the library has an extensive set of `unit tests * Reliability: the library has an extensive set of `unit tests
<https://github.com/vitaut/format/blob/master/format_test.cc>`__. <https://github.com/vitaut/format/blob/master/format_test.cc>`__.
* Safety: the library is fully type safe, errors in format strings are * Safety: the library is fully type safe, errors in format strings are
reported using exceptions. reported using exceptions, automatic memory management prevents buffer
overflow errors.
* Ease of use: small self-contained code base, no external dependencies, * Ease of use: small self-contained code base, no external dependencies,
permissive BSD `license`_. permissive BSD `license`_.
* `Portability`_ with consistent output across platforms and support * `Portability`_ with consistent output across platforms and support
@ -74,12 +75,11 @@ An object of any user-defined type for which there is an overloaded
Date(int year, int month, int day) : year_(year), month_(month), day_(day) {} Date(int year, int month, int day) : year_(year), month_(month), day_(day) {}
friend std::ostream &operator<<(std::ostream &os, const Date &d) { friend std::ostream &operator<<(std::ostream &os, const Date &d) {
os << d.year_ << '-' << d.month_ << '-' << d.day_; return os << d.year_ << '-' << d.month_ << '-' << d.day_;
return os;
} }
}; };
std::string s = str(fmt::Format("The date is {0}") << Date(2012, 12, 9)); std::string s = str(fmt::Format("The date is {}") << Date(2012, 12, 9));
// s == "The date is 2012-12-9" // s == "The date is 2012-12-9"
You can use `fmt::Formatter You can use `fmt::Formatter