++


lexicographical_compare() - 2


return a.length() <= b.length();

}

};

int main()

{

string arr1[] = { "Piglet", "Pooh", "Tigger" };

string arr2[] = { "Piglet", "Pooch", "Eeyore" };

bool res;

// false

// Pooch Pooh

// false

res = lexicographical_compare( arr1, arr1+3,

arr2, arr2+3 );

 

assert( res == false );

// true: ilist2

//

// ilist1

list< string, allocator > ilist1( arr1, arr1+3 );

list< string, allocator > ilist2( arr2, arr2+3 );

res = lexicographical_compare(

ilist1.begin(), ilist1.end(),

ilist2.begin(), ilist2.end(), size_compare() );

assert( res == true );

cout << "ok: lexicographical_compare !\n";

}




- -  - -  - -