Skip to content

Commit

Permalink
Revert "containers: avoid some copies"
Browse files Browse the repository at this point in the history
this causes some issues with comparison operators
might need some changes / fixes in cxxwrap

This reverts commit be9e0f9.
  • Loading branch information
benlorenz committed May 28, 2024
1 parent 0a89457 commit 953141a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions include/jlpolymake/containers.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ struct WrapMatrix

wrapped.module().set_override_module(pmwrappers::instance().module());
wrapped.method("_getindex",
[](const WrappedT& f, int64_t i, int64_t j) -> const elemType& {
return f(i - 1, j - 1);
[](const WrappedT& f, int64_t i, int64_t j) {
return elemType(f(i - 1, j - 1));
});
wrapped.method("_setindex!",
[](WrappedT& M, const elemType& r, int64_t i,
Expand Down Expand Up @@ -166,8 +166,8 @@ struct WrapVectorBase
wrapped.template constructor<int64_t>();

wrapped.module().set_override_module(pmwrappers::instance().module());
wrapped.method("_getindex", [](const WrappedT& V, int64_t n) -> const elemType& {
return V[n - 1];
wrapped.method("_getindex", [](const WrappedT& V, int64_t n) {
return elemType(V[n - 1]);
});
wrapped.method("_setindex!",
[](WrappedT& V, elemType val, int64_t n) {
Expand Down Expand Up @@ -251,8 +251,8 @@ struct WrapArrayImpl
wrapped.template constructor<int64_t, const elemType&>();

wrapped.module().set_override_module(pmwrappers::instance().module());
wrapped.method("_getindex", [](const WrappedT& V, int64_t n) -> const elemType& {
return V[static_cast<pm::Int>(n) - 1];
wrapped.method("_getindex", [](const WrappedT& V, int64_t n) {
return elemType(V[static_cast<pm::Int>(n) - 1]);
});
wrapped.method("_setindex!",
[](WrappedT& V, elemType val, int64_t n) {
Expand Down Expand Up @@ -289,8 +289,8 @@ struct WrapArrayImpl<pm::perl::BigObject::Array_element<readonly>>
wrapped.template constructor<pm::perl::BigObjectType, int64_t>();

wrapped.module().set_override_module(pmwrappers::instance().module());
wrapped.method("_getindex", [](const WrappedT& V, int64_t n) -> elemType {
return V[static_cast<pm::Int>(n) - 1];
wrapped.method("_getindex", [](const WrappedT& V, int64_t n) {
return elemType(V[static_cast<pm::Int>(n) - 1]);
});
wrapped.method("_setindex!",
[](WrappedT& V, elemType val, int64_t n) {
Expand Down Expand Up @@ -425,7 +425,7 @@ struct WrapMap
using valT = typename TypeWrapperT::type::mapped_type;

wrapped.module().set_override_module(pmwrappers::instance().module());
wrapped.method("_getindex", [](const WrappedT& M, const keyT& key) -> const valT& {
wrapped.method("_getindex", [](const WrappedT& M, const keyT& key) {
return M[key];
});

Expand Down

0 comments on commit 953141a

Please sign in to comment.