From 894b6fac8e67ac06238c5bf48d978ff428b2eb86 Mon Sep 17 00:00:00 2001 From: Daniel Marshall Date: Sun, 16 Sep 2018 17:09:15 +0100 Subject: [PATCH] Changed to use scoped enum Changed "reusing existing formatters example" to use scoped enum instead. --- doc/api.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api.rst b/doc/api.rst index 04122488..5ecaaa46 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -132,7 +132,7 @@ customize the formatted output. You can also reuse existing formatters, for example:: - enum color {red, green, blue}; + enum class color {red, green, blue}; template <> struct fmt::formatter: formatter { @@ -141,9 +141,9 @@ You can also reuse existing formatters, for example:: auto format(color c, FormatContext &ctx) { string_view name = "unknown"; switch (c) { - case red: name = "red"; break; - case green: name = "green"; break; - case blue: name = "blue"; break; + case color::red: name = "red"; break; + case color::green: name = "green"; break; + case color::blue: name = "blue"; break; } return formatter::format(name, ctx); }