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

Function main

10.06-stdArrayVsCArray2/main.cpp:8–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include <memory>
7
8int main()
9{
10 // #A Compiler deduces the size and type
11 const auto array = std::to_array("Hello, C++20");
12
13 // #B Compiler deduces the size and specify the type
14 const auto array2 = std::to_array<const char>("Hello, C++20");
15
16 // #C Create the array inline
17 const auto arrayFromList = std::to_array({3, 4, 5});
18
19 int intArray[]{3, 4, 5};
20 // #D Move the values
21 const auto movedArray = std::to_array(std::move(intArray));
22}

Callers

nothing calls this directly

Calls 1

moveFunction · 0.85

Tested by

no test coverage detected