case insensitive version of is_equal ! Case insensitive comparison predicate. Comparison is done using specified locales. */
| 50 | specified locales. |
| 51 | */ |
| 52 | struct is_iequal |
| 53 | { |
| 54 | //! Constructor |
| 55 | /*! |
| 56 | \param Loc locales used for comparison |
| 57 | */ |
| 58 | is_iequal( const std::locale& Loc=std::locale() ) : |
| 59 | m_Loc( Loc ) {} |
| 60 | |
| 61 | //! Function operator |
| 62 | /*! |
| 63 | Compare two operands. Case is ignored. |
| 64 | */ |
| 65 | template< typename T1, typename T2 > |
| 66 | bool operator()( const T1& Arg1, const T2& Arg2 ) const |
| 67 | { |
| 68 | #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) |
| 69 | return std::toupper(Arg1)==std::toupper(Arg2); |
| 70 | #else |
| 71 | return std::toupper<T1>(Arg1,m_Loc)==std::toupper<T2>(Arg2,m_Loc); |
| 72 | #endif |
| 73 | } |
| 74 | |
| 75 | private: |
| 76 | std::locale m_Loc; |
| 77 | }; |
| 78 | |
| 79 | // is_less functor -----------------------------------------------// |
| 80 |
no outgoing calls
no test coverage detected