Using C++ and the STL, does anybody know how to store integer arrays as nodes in an STL list or vector? I have an unknown number of pairs of numbers that I need to store, an
With C++11 there is a ::std::array wrapper available which can be used with standard containers like this:
#include
#include
#include
#include
int
main()
{
using t_Buffer = ::std::array<::std::int32_t, 2>;
using t_Buffers = ::std::list;
t_Buffers buffers;
buffers.emplace_back(t_Buffer{1, 2});
::std::cout << buffers.front()[0] << " " << buffers.front()[1] << ::std::endl;
return(0);
}
Run this code online