diff --git a/doc/api.rst b/doc/api.rst index 4d221195..0408a2c8 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -179,8 +179,7 @@ example:: enum class color {red, green, blue}; - template <> - struct fmt::formatter: formatter { + template <> struct fmt::formatter: formatter { // parse is inherited from formatter. template auto format(color c, FormatContext& ctx) { @@ -194,6 +193,15 @@ example:: } }; +Since `parse` is inherited from `formatter` it will recognize all +string format specifications, for example + +.. code-block:: c++ + + fmt::format("{:>10}", color::blue) + +will return " blue". + You can also write a formatter for a hierarchy of classes:: #include