ostream

    2熱度

    2回答

    我無法重載我的< <運算符來打印未知大小的數組的內容。我搜索了一個解決方案,但是我發現的唯一一個需要我將所有私有數據成員放在一個結構體中(這對我來說似乎有點不必要)。我無法編輯函數使其成爲朋友,或者將* q更改爲& q(或常量)。 這裏是我的< <超載代碼: ostream& operator<<(ostream& out, Quack *q) { if (q->itemCount()

    0熱度

    4回答

    我有一些問題,我的操作>> istream& operator>> (istream& is, Matrix& M) { char first; is>>first; for(int i = 0;i<M.rows();i++) { for(int j = 0;j<M.cols();j++) { is>>M[i][j];

    2熱度

    2回答

    #include"MyString.h" #include<iostream> MyString::MyString()//default constructor { length=0; data=NULL; cout<<"Default called by right none is called"<<endl; system

    2熱度

    1回答

    此源代碼有什麼問題? #include <iostream> #include <ostream> #include <fstream> void printTest (std::ostream * o) { *o << "test" << std::endl; } int main (int argc, char * argv[]) { std::ostr

    3熱度

    5回答

    我定義一個類是這樣的: class StaticRuntimeContext { public: enum Verbosity { kHIGH, kMEDIUM, kLOW, kSILENT }; static void Construct(); static std::ostream& stdout1() {ret

    5熱度

    2回答

    例如,我們已經創建並填充了一些std::vector<uchar>和openCV imencode。現在我們想要將它流式傳輸到一些http_lib中,例如可以採用某種類型的ostream(ostringstream),或者我們只是想用instream調試我們的程序時保存。所以我不知道如何把std::vector<uchar>放入std::ostream?

    -2熱度

    4回答

    我有一個程序顯示錯誤。我如何解決這個錯誤,並使用ostream的顯示輸出 使用G ++編譯器在我的Ubuntu #include<iostream> using namespace std; int main() { ostream out; out<<"Hello World"; }

    1熱度

    1回答

    我一直在尋找了一段時間,在最接近的答案是在那裏 toString override in C++ 參數太多但是我沒能讓它在我的課堂上工作。 我有一個Table2D.h其中包含此: std::string toString() const; std::ostream & operator<<(std::ostream & o, const Table2D<T> & s); ,我有一個模板類Ta

    38熱度

    4回答

    我正在尋找一個std::ostream實現,它的行爲如同/dev/null。它會忽略任何流式傳輸給它的東西。標準庫或Boost中是否存在這樣的事情?或者我必須推出自己的?

    0熱度

    1回答

    我有一個名爲項目基類: #ifndef ITEM_H #define ITEM_H #include <ostream> class Item { public: virtual ~Item() {} virtual void print(std::ostream& out) const {} friend std::ostream& operator <