STL의 remove_copy 함수를 다음과 같이 구현해 보았는데요.
template<class In, class Out, class Tp>
Out
remove_copy(In b, In e, Out d, const Tp& t)
{
while (b != e)
{
if (*b != t)
*d++ = *b;
++b;
}
return d;
}
다음과 같이 콜하니까,
list<int> a, d;
remove_copy(a.begin(), a.end(), back_inserter(d), 1);
함수형식이 다르다고 에러가 납니다. 그런데, 함수 선언부에서 네번째 인자의 const를 빼면 에러가 안나고요.