내 문자열은 !!(!())
입니다. 문자열에서 이중 느낌표를 제거하고 싶습니다.문자열을 사용한 remove_copy 사용
이 작동하지만이이 오류를 위의 라인을 던졌습니다 사용
remove_copy(str.begin(), str.end(),ostream_iterator<string>(cout), "!!");
작동하지 않습니다 그것은 모든 외침
remove_copy(str.begin(), str.end(),ostream_iterator<char>(cout), '!');//gives (())
을 제거
는/usr// C++/5/비트를 포함 /predefined_ops.h:194:17 : 오류 : ISO C++이 포인터와 정수를 비교하지 못하게 함 [-fpermissive] {return * __ it == _M_value;
OutputIterator remove_copy (InputIterator first, InputIterator last,
OutputIterator result, const T& val);
The function uses operator== to compare the individual elements to val.
remove_copy
의 문서를 읽기}
참조로 인해 문자열을 특별히 과부하가 발생시키지 않습니다. – chris
@chris ostream_iterator는'template>'을 가지고 있습니다. 즉, 문자열을 사용할 수 있다는 의미입니까? –
@SamidhT string은 문자 목록입니다. remove_copy는 목록을 반복하고 char을 제거합니다. 문자열 목록에서도 작동 할 수 있습니다. – Balu