"assert" function

Consider the following function access_element_by_index that
returns the iterator to the element at the index i in the list l.

typedef std::list<int> int_list;
int_list::iterator access_element_by_index(size_t i, int_list &l)
{
assert( ? );
...
}


Assume the first element of the list is at the index 0, the second at the index 1, and so on. If the function is required to return an iterator that can be dereferenced,determine the precondition of the function and write an assertion to validate it.
(You don't need to implement the function.)
Are you giving us orders? http://www.cplusplus.com/forum/beginner/1/
Last edited on
Topic archived. No new replies allowed.