Home | Libraries | People | FAQ | More |
The boost::segmented_tree::seq
container supports the interfaces of std::vector
and std::deque
, it can be used in the same way as
these containers with a few exceptions:
reserve()
and shrink_to_fit()
are missing.
boost::segmented_tree::seq
is inefficient. Instead users should use boost::segmented_tree::seq::nth
.
Boost.SegmentedTree is a header only C++11 library and it does not depend
on any other Boost libraries. Simply include boost/segmented_tree/seq.hpp
to start using it.
#include <algorithm> #include <iostream> #include <boost/segmented_tree/seq.hpp> int main() { boost::segmented_tree::seq<std::string> haystack(100000, "hay"); haystack.insert(haystack.nth(33333), "needle"); auto first = haystack.begin(); auto last = haystack.end(); auto it = std::find(first, last, "needle"); if (it != last) { std::cout << "Found needle at index: " << haystack.index_of(it) << "\n"; haystack.erase(it); } }