C++密钥和文件的映射不起作用
C++ map of a key and file doesn't work
我想在C++中创建密钥和相应文件的映射。我使用了下面的狙击手,它在最后一行给出了平均异常*m_jsTabFilesMap[key] << text;
:
std::map<std::string, std::ofstream*> m_jsTabFilesMap;
std::string text = "hello all";
std::string key = "a";
*m_jsTabFilesMap[key] << text;
显式删除std::ofstream
的复制构造函数。您必须通过指针或以不同的方式存储流,如果您希望流对象在映射中,请不要尝试复制流对象。
相关文章:
- 我的神经网络不起作用 [XOR 问题]
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- C++映射:具有自定义类的运算符[]不起作用(总是返回0)
- C++为什么尽管我调用了void函数,它却不起作用
- 为什么在保护模式下继承升级不起作用
- 循环在计数器中不起作用
- C++密钥和文件的映射不起作用
- 为什么我的结构中映射的构造函数不起作用
- 自定义类比较器的 STL 映射不起作用
- 带有自定义比较器的映射不起作用
- 在Visual C++中不起作用的函数的取消映射
- C++:STL 映射,插入新值不起作用
- 为什么带有 URL 映射的 Hello World 不起作用
- eclipse-cygwin源路径映射不起作用
- C++映射擦除(开始,结束)不起作用
- 映射 [] 操作数不起作用 C++
- 放置指向shared_ptr的多重映射的指针不起作用
- 当类用作映射值时,复制构造函数不起作用
- GLSL纹理映射不起作用
- 在 stl 映射中查找在编写自定义比较函数时不起作用,该函数会阻止键排序