mirror of
https://github.com/boostorg/array.git
synced 2025-06-26 12:31:41 +02:00
Compare commits
1 Commits
svn-branch
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
e27d7faaf6 |
@ -118,13 +118,13 @@ namespace boost {
|
|||||||
// operator[]
|
// operator[]
|
||||||
reference operator[](size_type i)
|
reference operator[](size_type i)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT_MSG( i < N, "out of range" );
|
BOOST_ASSERT( i < N && "out of range" );
|
||||||
return elems[i];
|
return elems[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
const_reference operator[](size_type i) const
|
const_reference operator[](size_type i) const
|
||||||
{
|
{
|
||||||
BOOST_ASSERT_MSG( i < N, "out of range" );
|
BOOST_ASSERT( i < N && "out of range" );
|
||||||
return elems[i];
|
return elems[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,11 +15,12 @@
|
|||||||
#include <boost/array.hpp>
|
#include <boost/array.hpp>
|
||||||
#include "print.hpp"
|
#include "print.hpp"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace boost;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// create and initialize array
|
// create and initialize array
|
||||||
boost::array<int,10> a = { { 1, 2, 3, 4, 5 } };
|
array<int,10> a = { { 1, 2, 3, 4, 5 } };
|
||||||
|
|
||||||
print_elements(a);
|
print_elements(a);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user