Array of fixed length circular buffers

Hi all,

If I want a std::array of size 3: std::array<int,3> y1;
If I want a circular buffer of size 10: boost::circular_buffer<int> y2(10);
If I want a std::array of size 3x3: std::array<std::array<int, 3>, 3> y3;

So how can one declare an array of circular buffers of fixed size?

I tried: std::array<boost::circular_buffer<int>(10), 3> y4;

However, I get: template argument for template type parameter must be a type. Responses appreciated.

Thanks very much
Last edited on
The size of boost::circular_buffer is not part of the type so I guess you would have to specify the size after you have created the array by calling the resize function on each circular buffer.

1
2
3
4
5
std::array<boost::circular_buffer<int>, 3> y4;
for (auto& cb : y4)
{
	cb.resize(10);
}
Last edited on
Topic archived. No new replies allowed.