Morwenn / tight_pair

A compressed pair for C++17
MIT License
25 stars 2 forks source link

Latest Release Code Coverage Pitchfork Layout

This experimental project is a small single-header header-only C++17 library providing a single tight_pair class template and associated functions. It is not meant to be anywhere near serious, but it was a fun little project to try to design a C++17-only component, and to optimize it as possible despite the underlying layers of abstraction :)

cruft::tight_pair is a C++17 compressed pair class. Unlike Boost.Compressed_Pair it is modelled after std::pair, with only a few additions and a few deletions. First, a short list of what is similar to the standard library's std::pair, then we will have a look at what makes them different:

Differences from std::pair

Now is the time to look at what actually makes this tight_pair different from the standard library's std::pair:

cruft::tight_pair also implements features library defects resolutions that were added to the standard after C++17 was published:

Compiler support and tooling

Ubuntu builds status Windows builds status MacOS builds status

tight_pair requires C++17 support, and should work with the following compilers:

The compilers listed above are the ones used by the CI pipeline, and the library is also tested with the most recent versions of those compilers on a regular basis. All the other compiler versions in-between are untested, but should also work. Feel free to open an issue if it isn't the case.

There might still be compiler errors with some corner cases that the library doesn't try to work around. The known ones are documented in a small knowledge base on the GitHub wiki.

WARNING: while the library works with MSVC, the codegen tends to be pretty poor.

Acknowledgements

I can't finish a project without stealing code around, so here are the main sources of the code that can be found in this project when I didn't write it by myself: