SetArrayArgument,真的是 last 还是 lenth?

SetArrayArgument, is it really the last or lenth?

我需要将副作用设置为 2 的数组大小,查看以下定义:

https://github.com/google/googletest/blob/master/googlemock/docs/CheatSheet.md

似乎对于大小为 2 的数组,参数应该是 (d.a、d.a + 1),但它不起作用,只有一个数组元素获得正确的值。以下代码每次都有效:

EXPECT_CALL(BFO, get(_, 2))
    .WillOnce(DoAll(SetArrayArgument<0>(d.a, d.a + 2), Return(2)));

我有点疑惑,为什么我需要为 2 的数组大小添加两个?

这个符号有点奇怪,但是 [first, last) 是 [first, last[ 或 [first, last-1]。不包括最后一个值。

An integer interval that has a finite lower or upper endpoint always includes that endpoint. Therefore, the exclusion of endpoints can be explicitly denoted by writing a .. b − 1 , a + 1 .. b , or a + 1 .. b − 1. Alternate-bracket notations like [a .. b) or [a .. b[ are rarely used for integer intervals.

来自Wikipedia.