#include <iostream>
#include <list>
#include <algorithm>
using namespace std;
template<typename Container, typename value>
bool remove_value(Container& c, value v)
{
if(auto it{find(begin(c), end(c), v)}; it != end(c))
{
c.erase(it);
return true;
}
return false;
}
int main()
{
list<int> myList {1,2,3,4,5,6,7,8,9,10};
//myList.erase(std::remove(myList.begin(), myList.end(), 7));
/*if(auto it{find(myList.begin(), myList.end(), 7)}; it != myList.end())
{
myList.erase(it);
}*/
if(int value = 7; remove_value(myList, value))
{
cout << "removed value: " << value << endl;
}
else
{
cout << "value: " << value << " not found" << endl;
}
for(int v:myList)
{
std::cout << v << ' ';
}
}