From 4ed7827f78ad5eda86ba75c89b3b97d19dcffe48 Mon Sep 17 00:00:00 2001 From: Longshan Du Date: Thu, 5 Jan 2023 20:47:05 +0800 Subject: [PATCH] Update cppguide.html --- cppguide.html | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/cppguide.html b/cppguide.html index a7f32245a..34e059dc4 100644 --- a/cppguide.html +++ b/cppguide.html @@ -300,7 +300,7 @@

Forward Declarations

user code to skip necessary recompilation when headers change. -
  • A forward declaration as opposed to an #include statement +
  • A forward declaration as opposed to an #include statement makes it difficult for automatic tooling to discover the module defining the symbol.
  • @@ -1812,7 +1812,7 @@

    Function Overloading

    You may write a function that takes a const std::string& and overload it with another that takes const char*. However, in this case consider -std::string_view +std::string_view instead.

    class MyClass {
    @@ -2133,7 +2133,7 @@ 

    Rvalue References

    objects. The syntax is similar to traditional reference syntax. For example, void f(std::string&& s); declares a function whose argument is an -rvalue reference to a std::string.

    +rvalue reference to a std::string.

    When the token '&&' is applied to an unqualified template argument in a function @@ -2850,9 +2850,9 @@

    Use of constexpr

    calls.

    -

    Prematurely marking something as constexpr may cause +

    Prematurely marking something as constexpr may cause migration problems if later on it has to be downgraded. -Current restrictions on what is allowed in constexpr +Current restrictions on what is allowed in constexpr functions and constructors may invite obscure workarounds in these definitions.

    @@ -4098,7 +4098,7 @@

    General Naming Rules

    Follow the convention that your project uses. If there is no consistent -local pattern to follow, prefer "_".

    +local pattern to follow, prefer "_".

    Examples of acceptable file names:

    @@ -4598,8 +4598,7 @@

    Function Argum values self-describing.
  • For functions that have several configuration options, consider - defining a single class or struct to hold all the options - , + defining a single class or struct to hold all the options, and pass an instance of that. This approach has several advantages. Options are referenced by name at the call site, which clarifies their meaning. It also reduces @@ -4964,7 +4963,7 @@

    Lambda Expressions

    lists like other comma-separated lists.

    For by-reference captures, do not leave a space between the -ampersand (&) and the variable name.

    +ampersand (&) and the variable name.

    int x = 0;
     auto x_plus_n = [&x](int n) -> int { return x + n; }
     
    @@ -5817,4 +5816,4 @@

    Windows Code

    - \ No newline at end of file +