From 78984d28b9d4355fd7397c76e25a90b31ad290ba Mon Sep 17 00:00:00 2001 From: Eduardo Almeida Date: Mon, 10 Oct 2022 19:25:49 +0100 Subject: [PATCH] doc: Minor adjustments to coding-style.rst --- doc/contributing/source/coding-style.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/contributing/source/coding-style.rst b/doc/contributing/source/coding-style.rst index 81e3a924b..5b0232b9c 100644 --- a/doc/contributing/source/coding-style.rst +++ b/doc/contributing/source/coding-style.rst @@ -1083,7 +1083,7 @@ of rules that should be observed while developing code. - Prefer to use ``.emplace_back()`` over ``.push_back()`` to optimize performance. - When creating STL smart pointers, prefer to use ``std::make_shared`` or - ``std::make_unique``, instead of creating the pointer with ``new``: + ``std::make_unique``, instead of creating the pointer with ``new``. .. sourcecode:: cpp @@ -1091,21 +1091,21 @@ of rules that should be observed while developing code. auto node = std::shared_ptr(new Node()); // Avoid - When looping through containers, prefer to use range-based for loops rather than - index-based loops: + index-based loops. .. sourcecode:: cpp - std::vector myVector = {1, 2, 3}; + std::vector myVector {1, 2, 3}; for (const auto& v : myVector) { ... } // Prefer for (int i = 0; i < myVector.size(); i++) { ... } // Avoid - When looping through containers, prefer to use const-ref syntax over copying - elements: + elements. .. sourcecode:: cpp - std::vector myVector = {1, 2, 3}; + std::vector myVector {1, 2, 3}; for (const auto& v : myVector) { ... } // OK for (auto v : myVector) { ... } // Avoid