Suppose we are given an STL vector container named vec that holds values of type double. What do each of vec[0], vec.front(), *(vec.begin()), *(vec.end() – vec.size())and *(vec.rend()-1) mean?

What will be an ideal response?


They all evaluate to the first element of the container. The expression vec[0] uses index 0 to fetch the first vector element. The expression vec.front() fetches the front element of vec. The expression *(vec.end() – vec.size())starts with an iterator past the end, subtracts the number of elements from this iterator, which results in an iterator to the first element of the vector. The expression *(vec.rend()-1) starts with an iterator in front of the first element, then moves one towards the rear (this is a reverse iterator) resulting in an iterator to the first element of the vector.

Computer Science & Information Technology

You might also like to view...

Describe the key characteristics of the Object Exchange Model (OEM).

What will be an ideal response?

Computer Science & Information Technology

Match each item with a statement below:

A. provides a command-line interface (CLI), which allows network operators to check the status of the router and network administrators to manage and configure the router B. the software that interprets the Cisco IOS commands C. network management software used to manage Cisco routers D. basic configuration mode in Cisco IOS E. allows you to configure the Ethernet and serial interfaces on your router F. specifies that users must log in when they access the console line G. editing command that moves the cursor to the beginning of the current line H. message that you can configure to display each time someone attempts to log in to the router I. helps you remember which network the interface services

Computer Science & Information Technology

?If _________ elements are floated along the same margin, they are placed alongside each other within a row.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

When video files are played while being downloaded from the Internet, it is called _____.

A. video compression B. virtual reality C. streaming video D. file conversion

Computer Science & Information Technology