"Integration of the Standard Template Library and the Microsoft Foundation Class" - читать интересную книгу автора (Wolfgang Paul, Song Yang)

2.4.5 Serializing CStrokeList and CStroke using Archive Iterators

The loops in CStrokeList:: serialize and CStroke:: serialize are then replaced by calls to the copy algorithm as follows:

Output of a CStrokeList:

CArchive_output_iterator‹CStroke*› oi(ar);

copy(begin(), end(), oi);

Input of a CStrokeList

CArchive_input_iterator‹CStroke*› ii(ar);

copy(ii, ii + s, back_inserter(*this));

Output of a CStroke

CArchive_output_iterator‹CPoint› oi(ar);

copy(m_pointArray.begin(), m_pointArray.end(), oi);

Input of a CStroke

CArchive_input_iterator‹CPoint› ii(ar);

copy(ii, ii + w, back_inserter(m_pointArray));