| 567 | |
| 568 | template<typename CharT> |
| 569 | inline typename basic_cstring<CharT>::size_type |
| 570 | basic_cstring<CharT>::rfind( basic_cstring<CharT> str ) const |
| 571 | { |
| 572 | if( str.is_empty() || str.size() > size() ) |
| 573 | return static_cast<size_type>(npos); |
| 574 | |
| 575 | const_iterator it = end() - str.size(); |
| 576 | const_iterator last = begin()-1; |
| 577 | |
| 578 | while( it != last ) { |
| 579 | if( traits_type::compare( it, str.begin(), str.size() ) == 0 ) |
| 580 | break; |
| 581 | |
| 582 | --it; |
| 583 | } |
| 584 | |
| 585 | return it == last ? static_cast<size_type>(npos) : static_cast<size_type>(it - begin()); |
| 586 | } |
| 587 | |
| 588 | //____________________________________________________________________________// |
| 589 | |