Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for iterator type error in example pyramid.cpp #90

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion example/pyramid.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <algorithm>
#include <vector>
#include <mcpp/block.h>
#include <mcpp/mcpp.h>
#include <mcpp/util.h>
Expand Down Expand Up @@ -30,8 +31,14 @@ int main() {
mc.getHeights(ORIGIN, ORIGIN + mcpp::Coordinate(pyramid_base_len, 0,
pyramid_base_len));

// Convert heights of build area to vector
std::vector<int> height_vals;
for (const auto& height : heights) {
height_values.push_back(height);
}

// Use minimum height of the area as the lowest point on the pyramid
int min_height = *std::min_element(heights.begin(), heights.end());
int min_height = *std::min_element(height_vals.begin(), height_vals.end());

// Build rings, diminishing up to pyramid height
mcpp::Coordinate base_pt = heights.base_pt();
Expand Down