Using rope - a STL container

Rope is a non-Standard STL container. It is used to manipulate huge string data. Operations such as assignment, concatenation and sub string are very fast in rope, independent of the length of string. Rope is not keeping the huge strings are contiguous allocation. Instead its splits and keeps the same, which makes these, types of operations faster.

The code samples that follow are examples on how to use rope. The examples are in C++ and display how to use Rope for constructing, concatenating, getting substrings from strings.

// Rope is crope.
std::crope MyRope( 1000000, 'x' ); // A million chars with 'x'

// Concatination.
std::crope MyRope2 = MyRope + "abc" + MyRope;

// Getting Substring
std::crope MyRope3 = MyRope2.substr(1000000, 3);

But rope is not suitable for traversing char by char, which is very slow. If you need fast substr like operation in a huge string, rope is preferable. But take care, this rope is not the part of Standard STL library. If you are using STLPort, rope will be available in your system. If you are strict to standards, rope will disappoint you.


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: