A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.com/reference/ios/basic_ios/imbue/ below:

public member function

<ios> <iostream>

std::basic_ios::imbue
locale imbue (const locale& loc);

Imbue locale

Associates loc to both the stream and its associated stream buffer (if any) as the new locale object to be used with locale-sensitive operations.

This function calls its inherited homonym ios_base::imbue(loc) and, if the stream is associated with a stream buffer, it also calls rdbuf()->pubimbue(loc).

All callback functions registered with member register_callback are called by ios_base::imbue.



Parameters
loc
locale object to be imbued as the new locale for the stream.

Return value The locale object associated with the stream before the call.

Example
1
2
3
4
5
6
7
8
9
10
11
// imbue example
#include <iostream>     // std::cout
#include <locale>       // std::locale

int main()
{
  std::locale mylocale("");   // get global locale
  std::cout.imbue(mylocale);  // imbue global locale
  std::cout << 3.14159 << '\n';
  return 0;
}

This code writes a floating point number using the global locale given by the environment. For example, in a system configured with a Spanish locale as default, this could write the number using a comma decimal separator:


Data races Modifies the stream object.
Concurrent access to the same stream object may cause data races.

Exception safetyBasic guarantee: if an exception is thrown, the stream is in a valid state.

See also
ios_base::imbue
Imbue locale (public member function)
ios_base::getloc
Get current locale (public member function)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4