question about iterator and algorithm

my function is not working i want it to print out and i have to do it using only iterator and algorithm library and i also look at copy for algorithm and not sure what to use form the iterator.
1
2
3
4
5
6
7
8
9
10
11
12
13
        private::
          std::string name;
	std::list<practice> example;
	void Write(std::ostream& os)
	{
		

		os << name << std::endl;
		std::for_each(example.begin(),example.end(),[&](int &i){

                  os << i << std::endl;//error here
                });
      }
Your list called example contains objects of type "practice" (whatever that is). Both your lambda function and subsequent output try to use objects of type "int".
Registered users can post here. Sign in or register to post.