Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::codecvt<InternT,ExternT,StateT>::always_noconv, do_always_noconv

      From cppreference.com
      <cpp‎ |locale‎ |codecvt
       
       
       
      Localization library
       
       
      Defined in header<locale>
      (1)
      public:
      bool always_noconv()constthrow();
      (until C++11)
      public:
      bool always_noconv()constnoexcept;
      (since C++11)
      (2)
      protected:
      virtualbool do_always_noconv()constthrow();
      (until C++11)
      protected:
      virtualbool do_always_noconv()constnoexcept;
      (since C++11)
      1) Public member function, calls the member functiondo_always_noconv of the most derived class.
      2) Returnstrue if bothdo_in() anddo_out() returnstd::codecvt_base::noconv for all valid inputs.

      [edit]Return value

      true if this conversion facet performs no conversions,false otherwise.

      The non-converting specializationstd::codecvt<char,char,std::mbstate_t> returnstrue.

      [edit]Notes

      This function may be used e.g. in the implementation ofstd::basic_filebuf::underflow andstd::basic_filebuf::overflow to use bulk character copy instead of callingstd::codecvt::in orstd::codecvt::out if it is known that the locale imbued in thestd::basic_filebuf does not perform any conversions.

      [edit]Example

      Run this code
      #include <iostream>#include <locale> int main(){std::cout<<"The non-converting char<->char codecvt::always_noconv() returns "<<std::boolalpha<<std::use_facet<std::codecvt<char,char,std::mbstate_t>>(std::locale()).always_noconv()<<'\n'<<"while wchar_t<->char codecvt::always_noconv() returns "<<std::use_facet<std::codecvt<wchar_t,char,std::mbstate_t>>(std::locale()).always_noconv()<<'\n';}

      Output:

      The non-converting char<->char codecvt::always_noconv() returns truewhile wchar_t<->char codecvt::always_noconv() returns false
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/locale/codecvt/always_noconv&oldid=160043"

      [8]ページ先頭

      ©2009-2026 Movatter.jp