Skip to content

Commit

Permalink
Add a template util to help create a typical_segment_tree; Release 0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Python-in-China committed Oct 15, 2024
1 parent da47f7f commit d753294
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions library/mrpython/typical_segment_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,18 @@ template <typename T>
using typical_segment_tree_max = typical_segment_tree<T, max>;
template <typename T>
using typical_segment_tree_min = typical_segment_tree<T, min>;

template <typename NodeStruct> class typical_segment_tree_from_node {
using T = typename NodeStruct::T;
struct MergeFunction {
T operator()(T const& a, T const& b) const {
return NodeStruct::merge_data(a, b);
}
};
typical_segment_tree_from_node() = delete;

public:
using type = typical_segment_tree<T, MergeFunction>;
};
} // namespace mrpython
#endif // MP_LIBRARY_SEGMENT_TREE_HPP
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "mp-oi-library",
"displayName": "mp-oi-library",
"description": "Some algorithms and data structures template for competitive programming.",
"version": "0.2.1",
"version": "0.2.2",
"repository": "https://github.com/Mr-Python-in-China/mp-oi-library",
"license": "LGPL-3.0-only",
"author": {
Expand Down

0 comments on commit d753294

Please sign in to comment.