MCPcopy Create free account
hub / github.com/andreasfertig/programming-with-cpp20 / main

Function main

11.01-rangeBaseForWithInit0/main.cpp:7–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <vector>
6
7int main()
8{
9 std::vector<int> v{2, 3, 4, 5, 6}; // #A
10
11 size_t idx{0}; // #B Belongs to the for but is in outer scope
12 for(const auto& e : v) {
13 // #C Show the position using idx
14 printf("[%zd] %d\n", idx++, e);
15 }
16}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected