Suppose you have a generic algorithm that requires forward iterators. Can I use it with a vector or a list even though these iterators are random access and bidirectional iterators respectively? Explain.

What will be an ideal response?


Yes. Iterators are an inclusive hierarchy. Random access iterators are bidirectional, and bidirectional iterators are forward iterators. So any iterators will work where a weaker iterator is specified.

Computer Science & Information Technology

You might also like to view...

A common music file format is ________

Fill in the blank(s) with correct word

Computer Science & Information Technology

Using the Find option in a table is an efficient way to locate a record in a table

Indicate whether the statement is true or false

Computer Science & Information Technology

Which of the following can be included in a bookmark name?

A. letters B. numbers C. the underscore character D. all of the above

Computer Science & Information Technology

The default amount of space between paragraphs is 8 points.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology