Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct StringComparator
- {
- StringComparator(bool ascending) : m_ascending(ascending)
- {
- }
- bool operator()(const char* first, const char* second) const
- {
- int result = StringUtility::compareNoCase(first, second);
- return m_ascending ? result <= 0 : result > 0;
- }
- bool m_ascending;
- };
- m_values.sort(StringComparator(true)); //ascending
- m_values.sort(StringComparator(false)); //descending
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement