Skip to content

JamesWrigley/flurc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flurc

A header-only C++ library implementing a circular buffer. Run make; ./test to compile and run the test suite.

Requires: A C++11 compliant compiler (the test suite uses GCC by default).

Functions provided:

  • flurc(int size) - Throws std::invalid_argument if size is negative
  • flurc(std::initializer_list)
  • clear()
  • empty()
  • full()
  • length()
  • pop() - Throws std::out_of_range if the buffer is empty
  • push(T t) - Throws std::out_of_range if the buffer is full

Example usage:

#include <iostream>
#include "flurc.hpp"

int main()
{
  flurc<int> foo(3); // Or, flurc<int> foo{ 2, 4, 8 }
  foo.push(2);
  foo.push(4);
  foo.push(8);

  while (!foo.empty())
    {
      std::cout << foo.pop() << std::endl;
    }
}

About

A library implementing a circular buffer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published