playground - cppreference.com
Namespaces
Variants

playground

From cppreference.com
  1. First
  2. Second
  3. Third
  4. Fourth
  5. Fifth
    • Fifth-1 [..c++20) (until C++20)
      • Fifth-1-a
      • Fifth-1-b [c++11..) (since C++11)
    • Fifth-2 [c++11..c++20) (since C++11)(until C++20)
      • Fifth-2-a
      • Fifth-2-a
    • Fifth-3 [..c++20) (until C++20)
      • Fifth-3-a
      • Fifth-3-a
    • Fifth-4
      • Fifth-4-a
      • Fifth-4-b [..c++20) (until C++20)
      • Fifth-4-b [c++14..c++20) (since C++14)(until C++20)

The potential scope of a name declared

  • in the init-statement of a [[../for|for loop]],
  • in the condition of a [[../for|for loop]],
  • in the range_declaration of a [[../range-for|range-for loop]],
  • in the init-statement of a [[../if|if statement]] or [[../switch|switch statement]],(since C++17)
  • in the condition of a [[../if|if statement]], [[../switch|switch statement]], or [[../while|while loop]]

begins at the point of declaration and ends at the end of the controlled statement.


Deduction guides

(since C++17)

(a slightly optimized variation.)