精華區beta EE_DSnP 關於我們 聯絡資訊
Array::iterator::operator + Array::iterator::operator += 這兩個函式教授給的 prototype 是下面這樣 iterator operator + (int) const { ... } iterator& operator += (int) { ... } 可是總覺得看起來怪怪的, 是否只是因為 int 後面沒有加變數名稱,自己加上去就可以了嗎? 可是我想問這邊的型態用 int 是不是代表使用者可以代負數進來? 我自己是覺得是不是改成這樣比較好? iterator operator + (size_t s) const { ... } iterator& operator += (size_t s) { ... } /******************************************************************/ 另外我想問,array 的 expand( size_t n ); 這個 n 是什麼意思? 還是說自行決定,只要我們自己寫的 public functions 知道怎麼代那個 n 然後能夠正常expand這樣就可以了? 感謝解惑 <(_ _)> -- . * . . .點點星空照上風~ . * . · -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.251.56 ※ 編輯: starsky7372 來自: 140.112.251.56 (12/07 02:32)