Here are some problem sets to practise your STL skills:
Problem sets involving std::bind()
The problems are like this:
- use std::bind() to simplify this code:
int sz = sizeof(arr)/sizeof(int);
int total = 0;
for( int i=0; i<sz; i++ )
{
add_if_number_is_odd( arr[i], &total );
}
Problems sets with function objects
Try to rewrite the following using function objects
Problem 1: calling a C-function. (solution).
Problem 2: calling a member function. (solution)
Problem 3: calling a member function with arguments. (solution)
Problem 4: calling a member function with arguments. (solution)
Problem 5: calling own member function. (solution)
No comments:
Post a Comment