Awesome
Chobo Single-Header Libraries
NO LONGER SUPPORTED! The successor is at iboB/itlib. New libraries and updates to the existing ones will be added there.
A collection of small single-header C++11 libraries by Chobolabs.
Build Status
OS and compiler | Build status |
---|---|
Linux / GCC 4.9 and 5.0 | |
Windows / MSVC 14 (2015) 32 and 64 bit |
Libraries
Every .hpp
file in include/chobo
is a standalone library and has no dependencies other than the standard lib.
library | description |
---|---|
optional.hpp | A class, which can hold an object by value but provides an invalid state as well. Similar to boost::optional . |
static_vector.hpp | A mix between std::vector and std::array : A dynamically sized container with fixed capacity (supplied as a template parameter). This allows you to have dynamically sized vectors on the stack or as cache-local value members, as long as you know a big enough capacity beforehand. Similar to boost::static_vector . |
flat_map.hpp | A class with the interface of std::map but implemented with an underlying std::vector -type container, thus providing better cache locality of the elements. Similar to boost::flat_map with the notable difference that the underlying container can be changed via a template argument (thus making the class not strictly an std::map drop-in replacement) |
vector_ptr.hpp | A non-owning std::vector pointer. Its purpose is to be used in generic code, which requires a vector. |
vector_view.hpp | A dangerous class which gives a view of an std::vector , changing the value_type . A strictly "I-know-what-I'm-doing" library, it's supposed to be used to obtain a view of std::vector<X> as something very similar to std::vector<Y> . It is HIGHLY recommended that X and Y are POD types, where one's size is a multiple of the other. |
small_vector.hpp | A mix between a vector and a static_vector . It's a dynamic array, optimized for use when the number of elements is small. Like static_vector is has a static buffer with a given capacity, but can fall back to dynamically allocated memory, should the size exceed it. Similar to boost::small_vector |
memory_view.hpp | A class which provides a std::vector like interface (sans the methods which might change the size or capacity) to a chunk of memory. |
vector.hpp | A std::vector drop-in replacement which has no debug checks. To be used in places where the performance is critical, even in "Debug" mode. |
More detailed documentation is available in each header file.
The libraries use the C++11 standard and there are no plans for support of earlier ones.
Usage
Choose one or more libraries that you like and copy somewhere in your include paths.
Supported compilers:
- VC 2015 or newer
- GCC 4.9 or newer
- Clang 3.2 or newer
Other C++11 compliant compilers may also work.
Contributing
Pull requests and issues are welcome.
Please make one pull request and issue per library, tagging them with the library name in the title with brackets. Example:
- [vector_view] Added insert methods
- [flat_map] Crash when using with xxxx container
Copyright
Copyright © 2016-2018 Chobolabs Inc.
This libraries are distributed under the MIT Software License. See LICENSE.txt for further details or copy here.