---
name: "std::collate_byname"
section: "3"
platform: "linux"
package: "libstdc++6-4.1-doc"
version: "4.1.2-25"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/std::collate_byname"
---

# std::collate\_byname(3)

## NAME

std::collate\_byname -

## SYNOPSIS

Inherits **std::collate\< \_CharT \>**.

## Detailed Description

### template\<typename \_CharT\> class std::collate\_byname\< \_CharT \>

Definition at line 2670 of file locale\_facets.h.

### Public Types

typedef \_CharT **char\_type**\
 typedef **basic\_string**\< \_CharT \> **string\_type**\

### Public Member Functions

template\<\> int **\_M\_compare** (const wchar\_t \*, const wchar\_t \*) const\
 template\<\> int **\_M\_compare** (const char \*, const char \*) const\
 int **\_M\_compare** (const \_CharT \*, const \_CharT \*) const \
 template\<\> size\_t **\_M\_transform** (wchar\_t \*, const wchar\_t \*, size\_t) const\
 template\<\> size\_t **\_M\_transform** (char \*, const char \*, size\_t) const\
 size\_t **\_M\_transform** (\_CharT \*, const \_CharT \*, size\_t) const \
 **collate\_byname** (const char \*\_\_s, size\_t \_\_refs=0)\
 int **compare** (const \_CharT \*\_\_lo1, const \_CharT \*\_\_hi1, const \_CharT \*\_\_lo2, const \_CharT \*\_\_hi2) const \
 long **hash** (const \_CharT \*\_\_lo, const \_CharT \*\_\_hi) const \
 **string\_type** **transform** (const \_CharT \*\_\_lo, const \_CharT \*\_\_hi) const \

### Static Public Attributes

static **locale::id** **id**\

### Protected Member Functions

virtual int **do\_compare** (const \_CharT \*\_\_lo1, const \_CharT \*\_\_hi1, const \_CharT \*\_\_lo2, const \_CharT \*\_\_hi2) const \
 virtual long **do\_hash** (const \_CharT \*\_\_lo, const \_CharT \*\_\_hi) const \
 virtual **string\_type** **do\_transform** (const \_CharT \*\_\_lo, const \_CharT \*\_\_hi) const \

### Static Protected Member Functions

static \_\_c\_locale **\_S\_clone\_c\_locale** (\_\_c\_locale &\_\_cloc)\
 static void **\_S\_create\_c\_locale** (\_\_c\_locale &\_\_cloc, const char \*\_\_s, \_\_c\_locale \_\_old=0)\
 static void **\_S\_destroy\_c\_locale** (\_\_c\_locale &\_\_cloc)\
 static \_\_c\_locale **\_S\_get\_c\_locale** ()\
 static const char \* **\_S\_get\_c\_name** ()\

### Protected Attributes

\_\_c\_locale **\_M\_c\_locale\_collate**\

### Friends

class **locale::\_Impl**\

## Member Typedef Documentation

### typedef \_CharT char\_type

Public typedefs.

Reimplemented from **collate**.

Definition at line 2675 of file locale\_facets.h.

### typedef basic\_string\<\_CharT\> string\_type

Public typedefs.

Reimplemented from **collate**.

Definition at line 2676 of file locale\_facets.h.

## Member Function Documentation

### int compare (const \_CharT \* \_\_lo1, const \_CharT \* \_\_hi1, const \_CharT \* \_\_lo2, const \_CharT \* \_\_hi2) const` [inline, inherited]`

Compare two strings.

This function compares two strings and returns the result by calling **collate::do\_compare()**.

**Parameters:**

*lo1* Start of string 1. \
 *hi1* End of string 1. \
 *lo2* Start of string 2. \
 *hi2* End of string 2.

**Returns:**

1 if string1 \> string2, -1 if string1 \< string2, else 0.

Definition at line 2552 of file locale\_facets.h.

### int do\_compare (const \_CharT \* \_\_lo1, const \_CharT \* \_\_hi1, const \_CharT \* \_\_lo2, const \_CharT \* \_\_hi2) const` [inline, protected, virtual, inherited]`

Compare two strings.

This function is a hook for derived classes to change the value returned.

**See also:**

**compare()**.

**Parameters:**

*lo1* Start of string 1. \
 *hi1* End of string 1. \
 *lo2* Start of string 2. \
 *hi2* End of string 2.

**Returns:**

1 if string1 \> string2, -1 if string1 \< string2, else 0.

Definition at line 2366 of file locale\_facets.tcc.

References basic\_string::c\_str(), basic\_string::data(), and basic\_string::length().

### long do\_hash (const \_CharT \* \_\_lo, const \_CharT \* \_\_hi) const` [inline, protected, virtual, inherited]`

Return hash of a string.

This function computes and returns a hash on the input string. This function is a hook for derived classes to change the value returned.

**Parameters:**

*lo* Start of string. \
 *hi* End of string.

**Returns:**

Hash value.

Definition at line 2449 of file locale\_facets.tcc.

### collate\< \_CharT \>::string\_type do\_transform (const \_CharT \* \_\_lo, const \_CharT \* \_\_hi) const` [inline, protected, virtual, inherited]`

Transform string to comparable form.

This function is a hook for derived classes to change the value returned.

**Parameters:**

*lo1* Start of string 1. \
 *hi1* End of string 1. \
 *lo2* Start of string 2. \
 *hi2* End of string 2.

**Returns:**

1 if string1 \> string2, -1 if string1 \< string2, else 0.

Definition at line 2405 of file locale\_facets.tcc.

References basic\_string::append(), basic\_string::c\_str(), basic\_string::data(), basic\_string::length(), and basic\_string::push\_back().

### long hash (const \_CharT \* \_\_lo, const \_CharT \* \_\_hi) const` [inline, inherited]`

Return hash of a string.

This function computes and returns a hash on the input string. It does so by returning **collate::do\_hash()**.

**Parameters:**

*lo* Start of string. \
 *hi* End of string.

**Returns:**

Hash value.

Definition at line 2585 of file locale\_facets.h.

### string\_type transform (const \_CharT \* \_\_lo, const \_CharT \* \_\_hi) const` [inline, inherited]`

Transform string to comparable form.

This function is a wrapper for strxfrm functionality. It takes the input string and returns a modified string that can be directly compared to other transformed strings. In the 'C' **locale**, this function just returns a copy of the input string. In some other locales, it may replace two chars with one, change a char for another, etc. It does so by returning **collate::do\_transform()**.

**Parameters:**

*lo* Start of string. \
 *hi* End of string.

**Returns:**

Transformed string\_type.

Definition at line 2571 of file locale\_facets.h.

## Member Data Documentation

### locale::id id` [inline, static, inherited]`

Numpunct facet id.

Definition at line 2511 of file locale\_facets.h.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
