서의 공간

<algorithm> mismatch 본문

C++/stl

<algorithm> mismatch

홍서의 2020. 12. 29. 21:11
// 파일이름: stl_algobase.h

template<typename InputIterator1, typename InputIterator2,
		typename BinaryPredicate>
pair<InputIterator1, InputIterator2>
mismatch(InputIterator1 first1, InputIterator2 last1,
    	InputIterator2 first2, BinaryPredicate binary_pred)
{
	while ( first1 != last1 && binary_pred(first1, first2))
    {
    	++first1;
        ++first2;
    }
    return pair<InputIterator1, InputIterator2>(first1, first2);
}

여기서 파라미터 binary_pred를 생략하면 predicate는 equal버전으로 호출한다.

 

 

'C++ > stl' 카테고리의 다른 글

<algorithm> is_heap()  (0) 2021.03.10
<algorithm> std::generate_n()  (0) 2021.02.03
<algorithm> std::find(), std::unique()  (0) 2020.12.31
<numeric> gcd, lcm 알고리즘  (0) 2020.12.29
stl 뜯어보기  (0) 2020.12.29
Comments