JustasMasiulis / circular_buffer

A constexpr STL style circular buffer implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to extract the numbers in a specific position gracefully?

3038922 opened this issue · comments

Thank you very much for your project.

circular_buffer<int, 4> cb{1, 2, 3};
cb.push_back(4); 
cb.push_back(5);
// 2,3,4,5
std::cout << "cb back():" << cb.back() << " cb back()-1:" << *(cb.data() + 3) <<  *(&cb.back() - 1) << std::endl;

Is there a more beautiful way?