aboutsummaryrefslogtreecommitdiff
path: root/impls
diff options
context:
space:
mode:
Diffstat (limited to 'impls')
-rw-r--r--impls/pingala.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/impls/pingala.cpp b/impls/pingala.cpp
index 97d3017..dc14f60 100644
--- a/impls/pingala.cpp
+++ b/impls/pingala.cpp
@@ -15,7 +15,7 @@ std::vector<std::string> generate_triangle(const size_t depth)
std::vector<size_t> items;
std::stringstream ss;
levels.reserve(depth);
- items.reserve(depth * depth);
+ items.resize(depth * depth);
#define AT(i, j) items[((i) * depth) + (j)]
AT(0, 0) = 1;
@@ -58,6 +58,7 @@ int main(int argc, char *argv[])
goto error;
levels = generate_triangle(depth);
+
for (const auto &level : levels)
{
for (size_t i = 0;