I tried to create for outputting the timing results and call any ofstream from pre-defined string:
#include <cstring>
#include <map>
#include <fstream>
using namespace std;
int main(void) {
map<string,ofstream> Map;
ofstream ofs("test_output");
string st="test";
Map[st] = ofs;
return 0;
}
I got the following error; how can I fix it?
a.cpp: In function ‘int main()’:
a.cpp:11:8: error: use of deleted function ‘std::basic_ofstream<_CharT, _Traits>& std::basic_ofstream<_CharT, _Traits>::operator=(const std::basic_ofstream<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits<char>]’
Map[s]=ofs;
^
In file included from a.cpp:3:0:
/usr/include/c++/5/fstream:744:7: note: declared here
operator=(const basic_ofstream&) = delete;
^
In file included from a.cpp:3:0:
/usr/include/c++/5/fstream:744:7: note: declared here
operator=(const basic_ofstream&) = delete;