Vector’s at function is used to get an element at particular index. It’s means that must be filled before to get. In literal meaning, at is representing as rvalue. While vector v[10] can be used as both means lvalue as well as rvalue. Vector v; For (int I = 0; I < 15; i++) { V[i] = i; } If v[i] will do range checking then you will be unable to assign data with subscript operator. Hence, there is no range check for subscript operator.
This comment has been removed by the author.
ReplyDeleteVector’s at function is used to get an element at particular index. It’s means that must be filled before to get. In literal meaning, at is representing as rvalue.
ReplyDeleteWhile vector v[10] can be used as both means lvalue as well as rvalue.
Vector v;
For (int I = 0; I < 15; i++)
{
V[i] = i;
}
If v[i] will do range checking then you will be unable to assign data with subscript operator.
Hence, there is no range check for subscript operator.