JavaScript is required

When declaring an iterator from the STL, the compiler automatically creates the right kind, depending upon the container it is used with.

A.

TRUE

B.

FALSE

Trả lời:

Đáp án đúng: A


Câu trả lời là SAI. Khi khai báo một iterator từ STL, bạn cần chỉ định rõ loại iterator nào (ví dụ: vector<int>::iterator, list<string>::const_iterator). Trình biên dịch không tự động suy ra loại iterator dựa trên container. Việc chỉ định tường minh loại iterator giúp trình biên dịch kiểm tra kiểu và đảm bảo tính an toàn của code.

Câu hỏi liên quan