---
name: "std::messages"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/std::messages"
---

# std::messages(3)

Primary class template messages.

## NAME

std::messages\< \_CharT \> - Primary class template messages.

## SYNOPSIS

\#include \<locale\>

Inherits **std::locale::facet**, and **std::messages\_base**.

Inherited by **std::messages\_byname\< \_CharT \>**.

### Public Types

typedef int **catalog**\

typedef \_CharT **char\_type**\
 Public typedefs.  typedef **basic\_string**\< \_CharT \> **string\_type**\
 Public typedefs.

### Public Member Functions

**messages** (\_\_c\_locale \_\_cloc, const char \*\_\_s, size\_t \_\_refs=0)\
 Internal constructor. Not for general use.  **messages** (size\_t \_\_refs=0)\
 Constructor performs initialization.  void **close** (catalog \_\_c) const\
 **string\_type** **get** (catalog \_\_c, int \_\_set, int \_\_msgid, const **string\_type** &\_\_s) const\
 catalog **open** (const **basic\_string**\< char \> &, const locale &, const char \*) const\
 catalog **open** (const **basic\_string**\< char \> &\_\_s, const locale &\_\_loc) const\

### Static Public Attributes

static **locale::id** **id**\
 Numpunct facet id.

### Protected Member Functions

virtual **~messages** ()\
 Destructor.  **string\_type** **\_M\_convert\_from\_char** (char \*) const\
 char \* **\_M\_convert\_to\_char** (const **string\_type** &\_\_msg) const\
 virtual void **do\_close** (catalog) const\
 void **do\_close** (catalog) const\
 void **do\_close** (catalog) const\
 **string** **do\_get** (catalog, int, int, const **string** &) const\
 Specializations for required instantiations.  virtual **string\_type** **do\_get** (catalog, int, int, const **string\_type** &\_\_dfault) const\
 **wstring** **do\_get** (catalog, int, int, const **wstring** &) const\
 virtual catalog **do\_open** (const **basic\_string**\< char \> &, const locale &) const\
 **messages**\< wchar\_t \>::catalog **do\_open** (const **basic\_string**\< char \> &, const locale &) const\
 **messages**\< char \>::catalog **do\_open** (const **basic\_string**\< char \> &, const locale &) const\

### Static Protected Member Functions

static \_\_c\_locale **\_S\_clone\_c\_locale** (\_\_c\_locale &\_\_cloc)  throw ()\
 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** ()  throw ()\
 static \_\_c\_locale **\_S\_lc\_ctype\_c\_locale** (\_\_c\_locale \_\_cloc, const char \*\_\_s)\

### Protected Attributes

\_\_c\_locale **\_M\_c\_locale\_messages**\
 const char \* **\_M\_name\_messages**\

## Detailed Description

### template\<typename \_CharT\>

class std::messages\< \_CharT \>"Primary class template messages.

This facet encapsulates the code to retrieve messages from message catalogs. The only thing defined by the standard for this facet is the interface. All underlying functionality is implementation-defined.

This library currently implements 3 versions of the message facet. The first version (gnu) is a wrapper around gettext, provided by libintl. The second version (ieee) is a wrapper around catgets. The final version (default) does no actual translation. These implementations are only provided for char and wchar\_t instantiations.

The messages template uses protected virtual functions to provide the actual results. The public accessors forward the call to the virtual functions. These virtual functions are hooks for developers to implement the behavior they require from the messages facet.

## Member Typedef Documentation

### template\<typename \_CharT\> typedef \_CharT std::messages\< \_CharT \>::char\_type

Public typedefs.

### template\<typename \_CharT\> typedef basic\_string\<\_CharT\> std::messages\< \_CharT \>::string\_type

Public typedefs.

## Constructor & Destructor Documentation

### template\<typename \_CharT\> std::messages\< \_CharT \>::messages (size\_t \_\_refs = 0) \[explicit\]

Constructor performs initialization. This is the constructor provided by the standard.

**Parameters**

*\_\_refs* Passed to the base facet class.

References **std::locale::facet::facet()**.

### template\<typename \_CharT\> std::messages\< \_CharT \>::messages (\_\_c\_locale \_\_cloc, const char \* \_\_s, size\_t \_\_refs = 0) \[explicit\]

Internal constructor. Not for general use. This is a constructor for use by the library itself to set up new locales.

**Parameters**

*\_\_cloc* The C locale. \
 *\_\_s* The name of a locale. \
 *\_\_refs* Refcount to pass to the base class.

References **std::locale::facet::facet()**.

### template\<typename \_CharT\> std::messages\< \_CharT \>::~messages () \[protected\], \[virtual\]

Destructor.

## Member Function Documentation

### string std::messages\< char \>::do\_get (catalog , int , int , const string & ) const \[protected\]

Specializations for required instantiations.

## Member Data Documentation

### template\<typename \_CharT\> locale::id std::messages\< \_CharT \>::id \[static\]

Numpunct facet id.

## Author

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