该代码片段确定整数是否在名为engie
的列表中。在列表中查找值
回报的std ::发现(engie.begin(),engie.end(),find_value)= engie.end()!;
为什么它是一个if语句比较迭代器到列表的末尾? 我意识到查找范围是[第一个,最后一个]
因此,对于包含整数{1,2,3}的列表,不是最后一个= 3? 它如何找到3
如果没有搜索?
Input iterators to the initial and final positions in a sequence. The range searched is [first,last), which contains all the elements between first and last, including the element pointed by first but not the element pointed by last.
是这个C++代码? – jeremyjjbrown
是的,对不起。忘了添加标签。 –
'[first,last]'表示包含“first”,但“last”不包含。请注意方括号和圆括号。 – juanchopanza