File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ namespace boost {
183
183
184
184
// check range (may be private because it is static)
185
185
static BOOST_CONSTEXPR bool rangecheck (size_type i) {
186
- return i > size () ? boost::throw_exception (std::out_of_range (" array<>: index out of range" )), true : true ;
186
+ return i >= size () ? boost::throw_exception (std::out_of_range (" array<>: index out of range" )), true : true ;
187
187
}
188
188
189
189
};
Original file line number Diff line number Diff line change @@ -27,6 +27,25 @@ namespace {
27
27
const arr &caRef = get_c_array ( test_case );
28
28
typename test_type::const_iterator iter = test_case.begin ();
29
29
BOOST_CHECK ( &*iter == &caRef[0 ] );
30
+
31
+ // Confirm at() throws the std lib defined exception
32
+ try {
33
+ test_case.at ( test_case.size ());
34
+ BOOST_CHECK (false );
35
+ }
36
+ catch ( const std::out_of_range & ) {}
37
+
38
+ try {
39
+ test_case.at ( test_case.size () + 1 );
40
+ BOOST_CHECK (false );
41
+ }
42
+ catch ( const std::out_of_range & ) {}
43
+
44
+ try {
45
+ test_case.at ( test_case.size () + 100 );
46
+ BOOST_CHECK (false );
47
+ }
48
+ catch ( const std::out_of_range & ) {}
30
49
}
31
50
}
32
51
You can’t perform that action at this time.
0 commit comments