Boost.Locale: boost::locale::comparator< CharType, default_level > Struct Template Reference

| Boost.Locale

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
boost::locale::comparator< CharType, default_level > Struct Template Reference
Collation

This class can be used in STL algorithms and containers for comparison of strings with a level other than primary. More...

`#include <boost/locale/collator.hpp>`

## Public Member Functions
| comparator (std::locale const &l=std::locale(), collator_base::level_type level=default_level)
bool | operator() (std::basic_string< CharType > const &left, std::basic_string< CharType > const &right) const

## Detailed Description

### template<typename CharType, collator_base::level_type default_level = collator_base::identical>
struct boost::locale::comparator< CharType, default_level >

This class can be used in STL algorithms and containers for comparison of strings with a level other than primary.

For example:

std::map<std::string,std::string,comparator<char,collator_base::secondary> > data;

Would create a map the keys of which are sorted using secondary collation level

## Constructor & Destructor Documentation

template<typename CharType , collator_base::level_type default_level = collator_base::identical>

boost::locale::comparator< CharType, default_level >::comparator | ( | std::locale const & | l = `std::locale()`,
|  | collator_base::level_type | level = `default_level`
| ) |  |
| inline

Create a comparator class for locale l and with collation leval level

Note
  throws std::bad_cast if l does not have collator facet installed

## Member Function Documentation

template<typename CharType , collator_base::level_type default_level = collator_base::identical>

bool boost::locale::comparator< CharType, default_level >::operator() | ( | std::basic_string< CharType > const & | left,
|  | std::basic_string< CharType > const & | right
| ) |  | const
| inline

Compare two strings – equivalent to return left < right according to collation rules

The documentation for this struct was generated from the following file:

- boost/locale/collator.hpp

- © Copyright 2009-2012 Artyom Beilis, Distributed under the Boost Software License, Version 1.0.