Skip to content

Commit

Permalink
Make an exception for bool types in priority_queue
Browse files Browse the repository at this point in the history
  • Loading branch information
barche committed Jun 16, 2024
1 parent e9869e8 commit 1e4b827
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/jlcxx/stl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,14 @@ struct WrapPriorityQueue
wrapped.method("cppsize", &WrappedT::size);
wrapped.method("pq_push!", [] (WrappedT& v, const T& val) { v.push(val); });
wrapped.method("pq_pop!", [] (WrappedT& v) { v.pop(); });
wrapped.method("pq_top", [] (WrappedT& v) { return v.top(); });
if constexpr(std::is_same<T,bool>::value)
{
wrapped.method("pq_top", [] (WrappedT& v) { return bool(v.top()); });
}
else
{
wrapped.method("pq_top", [] (WrappedT& v) { return v.top(); });
}
wrapped.method("pq_isempty", [] (WrappedT& v) { return v.empty(); });
wrapped.module().unset_override_module();
}
Expand Down

0 comments on commit 1e4b827

Please sign in to comment.