List.end().value should throw an out_of_range error #54
Labels
bug
Something isn't working
documentation
Improvements or additions to documentation
enhancement
New feature or request
Projects
Summary
List.end().value
throws anout_of_range
errorList.end().value
is possible (initial value:undefined
)Code occuring the bug
Detailed Story
When accessing to
Vector.end().value
, it throws anout_of_range
error. However, theList.end().value
does not throw theout_of_range
exception. It returns theundefined
value. Even configuring is to theList.end().value
is also possible.This story is also applicable to the
ForwardList
and even associate containers likeHashSet
andTreeMultiMap
. The associative containers, they manage elements using theList
container. Therefore, if an user try to access mapped-value to the end position likeAssociative.end().second
, the error message would be JS native error;Cannot set property 'second' of undefined
. The native error message can't represent the exact reason and situation.To keep the consistency and immediacy, I believe that the
List
should throw anout_of_range
error when accessing to theList.end().value
, even though it's not the regular spec of C++/STL standard.The text was updated successfully, but these errors were encountered: