Skip to content

Commit

Permalink
fix osx 10.13 error (#577)
Browse files Browse the repository at this point in the history
* fix osx 10.13 error

* errors regarding std::optional

* format
  • Loading branch information
pca006132 authored Oct 15, 2023
1 parent 062399c commit bec8164
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 4 additions & 5 deletions bindings/python/manifold3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,9 @@ NB_MODULE(manifold3d, m) {
std::optional<nb::ndarray<uint32_t, nb::shape<3>>> &normalIdx) {
glm::ivec3 v(0);
if (normalIdx.has_value()) {
if (normalIdx.value().ndim() != 1 ||
normalIdx.value().shape(0) != 3)
if (normalIdx->ndim() != 1 || normalIdx->shape(0) != 3)
throw std::runtime_error("Invalid vector shape, expected (3)");
auto value = normalIdx.value();
auto value = *normalIdx;
v = glm::ivec3(value(0), value(1), value(2));
}
return self.GetMeshGL(v);
Expand Down Expand Up @@ -624,7 +623,7 @@ NB_MODULE(manifold3d, m) {
runOriginalID->size());

if (runTransform.has_value()) {
auto runTransform1 = runTransform.value();
auto runTransform1 = *runTransform;
if (runTransform1.ndim() != 3 || runTransform1.shape(1) != 4 ||
runTransform1.shape(2) != 3)
throw std::runtime_error(
Expand All @@ -637,7 +636,7 @@ NB_MODULE(manifold3d, m) {
out.faceID = toVector<uint32_t>(faceID->data(), faceID->size());

if (halfedgeTangent.has_value()) {
auto halfedgeTangent1 = halfedgeTangent.value();
auto halfedgeTangent1 = *halfedgeTangent;
if (halfedgeTangent1.ndim() != 3 ||
halfedgeTangent1.shape(1) != 3 ||
halfedgeTangent1.shape(2) != 4)
Expand Down
6 changes: 3 additions & 3 deletions src/manifold/src/csg_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ using SharedImpl = std::variant<std::shared_ptr<const Manifold::Impl>,
struct GetImplPtr {
const Manifold::Impl *operator()(const SharedImpl &p) {
if (std::holds_alternative<std::shared_ptr<const Manifold::Impl>>(p)) {
return std::get<std::shared_ptr<const Manifold::Impl>>(p).get();
return std::get_if<std::shared_ptr<const Manifold::Impl>>(&p)->get();
} else {
return std::get<std::shared_ptr<Manifold::Impl>>(p).get();
return std::get_if<std::shared_ptr<Manifold::Impl>>(&p)->get();
}
};
};
Expand Down Expand Up @@ -495,7 +495,7 @@ std::shared_ptr<Manifold::Impl> CsgOpNode::BatchBoolean(
group.run_and_wait(process);
SharedImpl r;
queue.try_pop(r);
return std::get<std::shared_ptr<Manifold::Impl>>(r);
return *std::get_if<std::shared_ptr<Manifold::Impl>>(&r);
}
#endif
// apply boolean operations starting from smaller meshes
Expand Down

0 comments on commit bec8164

Please sign in to comment.