1 /* 2 fill 3 将[first, last) 内所有元素该填新值 4 */ 5 template<class ForwardIterator last, class T> 6 void fill (ForwardIterator first, ForwardIterator last, const T& value) { 7 for ( ; first != last; ++first) 8 *first = value; 9 } 10 11 // 将矩阵第 i 行0到n置0 12 fill(&matrix[i][0], &matrix[i][0]+n, 0);