aboutsummaryrefslogtreecommitdiff
path: root/templates/std_array.cpp
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-01-17 16:23:24 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2025-01-17 16:23:24 +0100
commit0b43d984905f07c59e3236d98d4e27409aba3cda (patch)
treeef707db657a9a3ff0da21ee06ac8df65f9a561a9 /templates/std_array.cpp
parentd0f3f64bb42ea8194c20f0eadd35821cab346143 (diff)
downloadtaming-cpp-0b43d984905f07c59e3236d98d4e27409aba3cda.tar.gz
taming-cpp-0b43d984905f07c59e3236d98d4e27409aba3cda.zip
More stuff with templates
Diffstat (limited to '')
-rw-r--r--templates/std_array.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/templates/std_array.cpp b/templates/std_array.cpp
new file mode 100644
index 0000000..8044cb2
--- /dev/null
+++ b/templates/std_array.cpp
@@ -0,0 +1,16 @@
1#include <array>
2#include <iostream>
3
4int main() {
5 std::array<double, 5> a {1.0, 1.1, 1.2};
6 std::cout << "Capacity of a: " << a.size() << std::endl;
7
8 a[3] = 1.3;
9 a[4] = 1.4;
10
11 for (auto x : a)
12 std::cout << x << " ";
13 std::cout << std::endl;
14
15 return 0;
16}

Generated with cgit - Back to sebastiano.tronto.net