1 2 3
|
boost::array< int, 15 > next_value = {
5, -1, 8, 0, 16, 7, 2, 9, -3, 4, 6, -2, 0, -8, 13
};
|
would work, however, and provides the same interface as vector<> in terms of
element access (though of course boost::array<> is not dynamically sizable).
In lieu of boost, this is what I would do:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
template< typename T, size_t N >
T* abegin( T (&a)[ N ] )
{ return &a[0]; }
template< typename T, size_t N >
T* aend( T (&a)[ N ] )
{ return &a[N]; }
static const int next_value[] = {
5, -1, 8, 0, 16, 7, 2, 9, -3, 4, 6, -2, 0, -8, 13
};
std::vector<int> v( abegin( next_value ), aend( next_value ) );
|
|