Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::basic_istream<CharT,Traits>::operator=

      From cppreference.com
      <cpp‎ |io‎ |basic istream
       
       
       
       
      protected:
      basic_istream& operator=(const basic_istream& rhs)= delete;
      (1)
      protected:
      basic_istream& operator=( basic_istream&& rhs);
      (2)(since C++11)
      1) The copy assignment operator is protected, and is deleted. Input streams are not CopyAssignable.
      2) The move assignment operator exchanges thegcount() values and all data members of the base class, except forrdbuf(), withrhs, as if by callingswap(*rhs). This move assignment operator is protected: it is only called by the move assignment operators of the derived movable input stream classesstd::basic_ifstream andstd::basic_istringstream, which know how to correctly move-assign the associated streambuffers.

      [edit]Parameters

      rhs - the basic_istream object from which to assign to*this

      [edit]Example

      Run this code
      #include <iostream>#include <sstream> int main(){std::istringstream s1;    s1=std::istringstream("test");// OK //  std::cin = std::istringstream("test"); // ERROR: 'operator=' is protected}
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/io/basic_istream/operator%3D&oldid=158523"

      [8]ページ先頭

      ©2009-2025 Movatter.jp