0
최근에 C++ Primer의 템플릿 섹션을 읽었으며 VS2013에서이 템플릿을 사용하려고합니다. 다음과 같은 템플릿 찾기를 작성합니다.Visual C++에서 템플릿 함수를 사용하는 데 문제가 있습니다
#include <vector>
template <typename iteratorT, typename valT>
iteratorT find(const iteratorT &up, const iteratorT &end, const valT &val)
{
auto iter = up;
while (iter != end && *iter != val)
++iter;
return ++iter;
}
int main()
{
std::vector<int> v{ 1, 2, 3, 4, 5, 6, 7, 8, 9 };
auto i = find(v.cbegin(), v.cend(), 7);
}
하지만 비주얼 스튜디오 나에게
1 IntelliSense: more than one instance of function template "find" matches the argument list:
function template "_InIt std::find(_InIt _First, _InIt _Last, const _Ty &_Val)"
function template "iteratorT find(const iteratorT &up, const iteratorT &end, const valT &val)"
argument types are: (std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<int>>>, std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<int>>>, int) d:\Projects\ConsoleApplication1\ConsoleApplication1\Source.cpp 16 11 ConsoleApplication1
내가, 내가 왜의 표준 버전은 "발견"할 사람이 말해 줄 수, "네임 스페이스 표준을 사용하여"사용하지 않은 여기에 혼란 올거야 말할 ?
귀하의 도움에 감사드립니다. D.
gcc에서 시도해 보니 정확하게 말했듯이 감사합니다. D, 나는 버그라고 생각했습니다 ... – jankjn