1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
#include <rope>
#include <string>
#include <iostream>
using namespace std;
template <class T>
class test
{
public:
test( int b , int i );
};
template <class T>
test<T>::test( int b , int n )
{
// tests OK ========================================
// crope r1(1000000,'x');
// crope r2=r1+"A";
// reverse(r2.mutable_begin(),r2.mutable_end());
// tests OK ========================================
T s( b , 'a' );
T v;
v=s;
for ( int i = 0 ; i < n ; ++i ) {
v = s;
v.insert( 0 , "qwerty" );
cout << v << endl;
int j;
for(j=0;j<10;j++) v.append( "i" );
for(j=0;j<2;j++) v.insert( 10 / 2 , "zxcvb" );
v.replace( b / 2 , 20U, "abcdefg" );
// ?????????????????????????????????????????????????????????
// v.replace(1,2,3,4);
// ?????????????????????????????????????????????????????????
cout << v << endl;
}
}
int bs;
int n;
// bool use_str = true;
bool use_str = false;
int main ( int argc , char * const *argv )
{
bs=10; n=1;
if ( !use_str ) {
test<rope<char> > t( bs , n );
} else {
test<string> t( bs , n );
}
return 0 ;
}
|