justasmasiulis / circular_buffer Goto Github PK
View Code? Open in Web Editor NEWA constexpr STL style circular buffer implementation
License: Apache License 2.0
A constexpr STL style circular buffer implementation
License: Apache License 2.0
May suggest a test that fails?
Insert a vector as an attribute
struct leak_checker {
leak_checker() { ++num_constructions; }
~leak_checker() { ++num_deletions; }
leak_checker(const leak_checker&) { ++num_constructions; }
leak_checker(leak_checker&&) { ++num_constructions; }
leak_checker& operator=(const leak_checker&) = default;
leak_checker& operator=(leak_checker&&) = default;
std::vector<float> numbers;
};
I couldn't use your circular_buffer with any of my defined types. For instance, none of the classes defined here https://en.cppreference.com/w/cpp/language/rule_of_three
I am using msvc 2017 and it throws an error nad a warning:
Thanks
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?
First, thanks for the nice package.
My request is whether the template parameter N
be made into a variable rather a constant? I have use cases that the size of the buffer is unknown, and is set in a configuration file. It is one less constraint for the circular buffer class. Let me know how you think.
The documentation is not overly verbose.
I cannot read, what is returned via pop_front()
after the ring buffer producer has already overwritten the current reading position element. Is the reading position moved as well ? Could you explain ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.