From ae1fb0c451618c48725a0b18ffb85ea923f4b2c9 Mon Sep 17 00:00:00 2001 From: Eduardo Almeida Date: Thu, 3 Nov 2022 18:01:47 +0000 Subject: [PATCH] doc: Update coding-style.rst with trailing comma in braced-init-lists --- doc/contributing/source/coding-style.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/contributing/source/coding-style.rst b/doc/contributing/source/coding-style.rst index 4ef3ac654..33bd4c5ce 100644 --- a/doc/contributing/source/coding-style.rst +++ b/doc/contributing/source/coding-style.rst @@ -1081,6 +1081,23 @@ Miscellaneous items int* ptr = &x; int& ref = x; +- Use a trailing comma in braced-init-lists, so that each item is positioned in a new line. + + .. sourcecode:: cpp + + const std::vector myVector{ + "string-1", + "string-2", + "string-3", + }; + + const std::map myMap{ + {1, "string-1"}, + {2, "string-2"}, + {3, "string-3"}, + }; + + - Const reference syntax: .. sourcecode:: cpp