Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::basic_ios<CharT,Traits>::imbue

      From cppreference.com
      <cpp‎ |io‎ |basic ios
       
       
       
       
      std::locale imbue(conststd::locale& loc);

      Replaces the current locale. Effectively callsios_base::imbue(loc) and if there is an associated stream buffer (rdbuf()!=0), then callsrdbuf()->pubimbue(loc).

      Contents

      [edit]Parameters

      loc - the new locale

      [edit]Return value

      The previous locale, as returned byios_base::imbue(loc).

      [edit]Exceptions

      May throw implementation-defined exceptions.

      [edit]Example

      Run this code
      #include <iostream>#include <locale>#include <sstream> int main(){std::istringstream iss;    iss.imbue(std::locale("en_US.UTF8")); std::cout<<"Current locale: "<< iss.getloc().name()<<'\n';     iss.imbue(std::locale());std::cout<<"Global locale : "<< iss.getloc().name()<<'\n';}

      Output:

      Current locale: en_US.UTF8Global locale : C
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/io/basic_ios/imbue&oldid=158185"

      [8]ページ先頭

      ©2009-2025 Movatter.jp