GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::basic_filebuf::operator=(3) C++ Standard Libary std::basic_filebuf::operator=(3)

std::basic_filebuf::operator= - std::basic_filebuf::operator=


std::basic_filebuf& operator=( std::basic_filebuf&& rhs ); (since C++11)
std::basic_filebuf& operator=( const std::basic_filebuf& rhs ) =
delete;


Assigns another basic_filebuf object.


1) First calls close() to close the associated file, then moves the contents of rhs
into *this: the put and get buffers, the associated file, the locale, the openmode,
the is_open flag, and any other state. After the move, rhs is not associated with a
file and rhs.is_open() == false.
2) The copy assignment operator is deleted; basic_filebuf is not CopyAssignable.


rhs - another basic_filebuf that will be moved from


*this

// Run this code


#include <fstream>
#include <string>
#include <iostream>


int main()
{


std::ifstream fin("test.in"); // read-only
std::ofstream fout("test.out"); // write-only


std::string s;
getline(fin, s);
std::cout << s << '\n'; // output


*fin.rdbuf() = std::move(*fout.rdbuf());


getline(fin, s);
std::cout << s << '\n'; // empty line


std::cout << std::boolalpha << fout.is_open() << '\n'; // prints "false"


}


constructor constructs a basic_filebuf object
(public member function)
swap swaps two basic_filebuf objects
(C++11) (public member function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.