ostream

    0热度

    1回答

    中没有匹配我面临跟随错误,我不明白操作员是否有可用的朋友< <关于argsMap为什么它仍然是垃圾分类? 是否有人可以帮助 Args.C: In function âstd::ostream& operator<<(std::ostream&, const Args&)â: Args.C:166: error: no match for âoperator<<â in âos << ((cons

    3热度

    2回答

    我有一个基于ostream的子类,它捕获我的程序的调试消息。 /** @brief Customized output stream with "tee" feature */ template <typename CharT, typename Traits = std::char_traits<CharT> > class basic_tostream : public std::basi

    3热度

    2回答

    所以我试图设计一个程序,输入一个文件,然后通过行读取,并采取每一行,并输出有关它的信息到一个新的文件。 我把它全部倒下......除了!我所有的.txt文件都被垃圾填满,而不是填满它们。 我找不出来。如果我关注我正在输入的字符串,右边的东西会打印在屏幕上。 fstream lineOutFile; string newFileName; stringstream linefile; lin

    4热度

    3回答

    在我的C++代码中,我不断向文件中写入不同的值。我的问题是,如果有任何情况下写或<会失败,考虑到文件已成功打开的事实。我是否需要检查每一次写入或< <以确保它正确执行?

    0热度

    1回答

    我试图使用模板函数来打印指向我的列表中的对象的属性。 class SomeClass { public: double myVal; int myID; } std::list< boost::shared_ptr<SomeClass> > myListOfPtrs; for (int i = 0; i < 10; i++) { boost::sha

    -2热度

    2回答

    #include<iostream> using namespace std; int main() { ostream os=cout; os<<"ABC"; } 这是给我编译错误。

    0热度

    2回答

    重载<<运算符时的最佳做法是什么?特别是,我如何区分指针与对象之间的运行。输入<<时是否输出相同的字符串是否可以使用? 例如,请考虑下面的代码,这两个Book对象已经初始化 Book b1; Book* b2; // initialization stuff // can both of these output the same representation of a book obj

    -1热度

    1回答

    我有以下类实现: class NUMS { int* numbers; int size; public: ostream& operator << (ostream& out, NUMS const& nums) { for (int i = 0; i < size; ++i) out << nums.numbers[i] << " \n";

    1热度

    2回答

    有没有简单的方法来检查stl :: ostream中是否有序列化内容。我正在寻找类似于: some preparation // ... a very complex code that may result in adding or not to the stream, // that I will prefer not to change check if the stream ha

    9热度

    5回答

    为什么我不能像这样 std::ostream out; 我的输出创建一个“空”流? 此行是根据与libstdc++ Linux的clang 3.4和gcc 4.8.1显然是非法的,我真的不知道为什么,我的意思是,为什么我不能只是出于创建流无处并使用它就像我想?请注意,std::ofstream out;是100%确定。我只是不明白这背后的逻辑。 如果你认为创建后我可以使用这个缓冲区,并与其他缓