• Stars
    star
    110
  • Rank 316,770 (Top 7 %)
  • Language
    C++
  • License
    MIT License
  • Created about 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A collection of std-like single-header C++ libraries

itlib: iboB's Template Libraries

A collection of small single-header C++ libraries similar to or extending the C++ standard library. See below for a list.

Language License

itlib was forked from chobo-shl which is no longer supported. New libraries and updates to the existing ones are added here.

Build Status

Building with GitHub actions on Windows with MSVC, Ubuntu with GCC, and macOS with clang. Debug and Release. With address sanitizer and thread sanitizer where applicable.

Build

Libraries

Every .hpp file in include/itlib is a standalone library and has no dependencies other than the standard lib.

Documentation is provided in comments at the top of each file.

In the list below each library shows its minimum supported C++ standard and has icons for other standards if additional features are available for them.

Library Description
any.hpp Standard An alternative implementation of C++17's std::any without the limitation of required copyability for the values inside and with the possibility to set a custom allocator.
atomic.hpp Standard Utility extensions for <atomic>.
atomic_shared_ptr_storage.hpp Standard A wrapper for std::shared_ptr<T> which allows atomic load, store and exchange. An alternative to C++20's std::atomic<std::shared_ptr<T>>.
data_mutex.hpp Standard Standard A template pair of an object and a mutex used to synchronize access to it. It makes it hard to cause bugs by forgetting to lock a mutex associated with an object.
dynamic_bitset.hpp Standard A class similar to std::bitset, but the number of bits is not a part of the type. It's also somewhat similar to std::vector<bool>, but (so far) it has more limited modification capabilities.
expected.hpp Standard A union type of a value and an error. Similar to the std::expected from C++23.
flat_map.hpp Standard 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.
flat_set.hpp Standard A class with the interface of std::set but implemented with an underlying std::vector-type container, thus providing better cache locality of the elements. Similar to boost::flat_set with the notable difference that the underlying container can be changed via a template argument.
pmr_allocator.hpp Standard A C++17 wrapper of std::pmr::polymorphic_allocator which provides functionalities introduced in C++20 for it.
mem_streambuf.hpp Standard Two helper classes: mem_ostreambuf and mem_istreambuf which allow you to work with std::stream-s with buffers of contiguous memory.
mem_streambuf.hpp Standard Two helper classes: mem_ostreambuf and mem_istreambuf which allow you to work with std::stream-s with buffers of contiguous memory.
pod_vector.hpp Standard A container similar to std::vector, which contains PODs. This fact is used to improve performance by skipping constructor and destructor calls and using memcpy and memmove to copy data, and malloc and free, and, most importantly realloc, and _expand if available, to manage memory.
poly_span.hpp Standard A class similar to C++20's std::span which offers a polymorphic view over a buffer of objects.
qalgorithm.hpp Standard Wrappers of <algorithm> functions which work on entire containers for less typing in the most common use-cases.
rstream.hpp Standard Read stream. Simple std::istream wrappers which don't allow seeks, allowing you to be certain that reads are sequential, and thus allow a redirect, so you can represent several streams as one.
sentry.hpp Standard Standard A sentry class which executes a function object on destruction. Works with C++11, but it's slightly easier to use with C++17.
shared_from.hpp Standard A helper class to replace std::enable_shared_from_this providing a more powerful interface. Similar to enable_shared_from from Boost.SmartPtr
small_vector.hpp Standard A mix between std::vector and itlib::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
span.hpp Standard Standard A C++11 implementation of C++20's std::span
static_vector.hpp Standard 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.
stride_span.hpp Standard A C++11 implementation C++20's of std::span with a dynamic extent and an associated stride.
strutil.hpp Standard A collection of small utilities for std::string_view
time_t.hpp Standard A thin wrapper of std::time_t which provides thread safe std::tm getters and type-safe (std::chrono::duration-based) arithmetic
type_traits.hpp Standard Standard Additional type traits to extend the standard library's <type_traits>
ufunction.hpp Standard Standard Unique function. A replacement of std::function which is non-copyable (can capture non-copyable values, and wrap non-copyable objects), and noexcept move-constructible (won't implicitly make owners no-noexcept move-constructible)
utility.hpp Standard Several generally unrelated utility functions and helpers

Usage

Clone the repo or choose one or more libraries that you like and copy them somewhere in your include paths.

Every library is self-contained so you can copy, move, and modify whichever you like and not wory about interdependencies.

Contributing

Pull requests and issues are welcome.

Please make separate commits per library, tagging them with the library name in the title with brackets. Example:

  • [small_vector] Added insert methods
  • [flat_map] Crash when using with xxxx container

You can use CMake to generate a project and run the tests locally.

Copyright

Copyright © 2016-2019 Chobolabs Inc.

Copyright © 2020-2023 Borislav Stanimirov

These libraries are distributed under the MIT Software License. See LICENSE.txt for further details or copy here.

More Repositories

1

dynamix

🍥 A new take on polymorphism
C++
644
star
2

picobench

A micro microbenchmarking library for C++11 in a single header file
C++
185
star
3

boost.mixin

Boost.Mixin is a C++ implementation of the Mixin idiom
C++
43
star
4

html5-gui-demo

Demos for using HTML 5 as a GUI for C++ apps
C++
41
star
5

mscharconv

<charconv> from Microsoft STL, but multi-platform
C++
37
star
6

mtime_cache

CLI gem to help make use of build artifacts cache in a CI system
Ruby
24
star
7

git-lfs-download

Download full or partial git-lfs repos without temporarily using 2x disk space
Ruby
21
star
8

cef-demos

Some demos and experiments with CEF
C++
19
star
9

cef-cmake

CMake helpers for CEF (the Chromium Embedded Framework)
CMake
18
star
10

b_stacktrace

A minimalistic single-header multi-platform C89 lib for stack tracing
C
12
star
11

yama

Yet Another MAthematical library
C++
11
star
12

cpp-dynamic-polymorphism

List of resources about modern dynamic polymorphism in C++.
11
star
13

dllpatch

CLI util: Poor man's rpath for Windows executables.
C++
9
star
14

fishnets

A WebSocket server and client library for C++17
C++
9
star
15

xec

A small library for multi-threaded execution contexts and task executors
C++
8
star
16

VSOpenFileFromDir

VSCode-style open file (ctrl-p) functionality for Visual Studio
C#
7
star
17

jalog

Just Another Logging library for C++
C++
7
star
18

furi

A header-only URI library for C99 and C++17
C
7
star
19

xmem

An alternative memory and smart pointer library for C++
C++
6
star
20

cmake-pch

A simple modern CMake (3.2+) script which adds a precompiled header to a target
CMake
6
star
21

kuzco

No touchy! Immutable state for C++
C++
5
star
22

huse

A C++ library for HUman-readable SErialization
C++
5
star
23

envo

An environment variable manager
Ruby
4
star
24

crake

A CMake generator written in Ruby
Ruby
4
star
25

doctest-util

Utilities for C++ unit testing with doctest
C++
4
star
26

cfc-demos

Demos for my talk CPU-Friendly Code
C++
4
star
27

mathgp

MathGP - a simple math library for game programming
C++
4
star
28

trex

🦖 A header-only type registry library for C++11
C++
4
star
29

ibob.github.com

Personal website
HTML
4
star
30

icm

A collection of CMake modules
CMake
3
star
31

cpp-lib-template

A template for a C++ library
CMake
3
star
32

dynamix-c

A dynamic polymorphism library for C
C
3
star
33

BlockOut3000

A small 3D puzzle game
C++
3
star
34

maibo

Yet another C++ multi-platform multimedia library
C++
2
star
35

confy

A C++17 application configuration library
C++
2
star
36

doctest-lib

A CMake wrapper of https://github.com/doctest/doctest/ to make life easier
C++
2
star
37

c-utf8

utf8 ⇔ utf32 (Unicode) conversion for C an C++
C++
2
star
38

word-grid

A word game where you find words in adjacent cells in a grid
C++
2
star
39

vec-span-demo

Demo code for my talk "Beyond std::vector and std::span"
C++
2
star
40

natvis-join

A tool which joins multiple .natvis files into a single one
Ruby
2
star
41

jsc-standalone

Binaries for using Apple's JavaScriptCore as a standalone library
C
2
star
42

evoshooter

Global Game Jam project
C++
2
star
43

boost-trim

A trimmed-down subset of boost
C++
2
star
44

advent-of-code

My Advent of Code solutions
Ruby
1
star
45

ubsan-fp

A false positive in the undefined behavior sanitizer (pre clang 9)
CMake
1
star
46

splat

Small platform or compiler-specific macros and helpers for C and C++
C
1
star
47

mixquest

A game-like demo of DynaMix
C++
1
star
48

clang-fwd-decl-bug

clang fails to compile a forward declared template argument
C++
1
star
49

flashcards

A generator of flashcards
JavaScript
1
star
50

trie-map-bench

Comparing a trie map to other associative containers
CMake
1
star