A header-only library of modern C++ idioms
For example:
- Fast pImpl (Pointer To Implementation)
- Zero overhead cost implementation
class Book final
{
public:
std::string const& contents();
private:
std::string contents_;
};
#include <tiny_utils/fast_pimpl.h>
class Book final
{
public:
std::string const& contents();
private:
struct implementation;
static int constexpr length{24};
static int constexpr alignment{8};
tiny_utils::fast_pimpl_t<implementation, length, alignment, false> impl_;
};
If we are using Microsoft C++ (MSVC), we should use tiny_utils::length(40, 32, 24)
because Debug
and Release
have different values of sizeof(Book)
.
#include <tiny_utils/fast_pimpl.h>
class Book final
{
public:
std::string const& contents();
private:
struct implementation;
static int constexpr length = tiny_utils::length(40, 32, 24);
static int constexpr alignment{8};
tiny_utils::fast_pimpl_t<implementation, length, alignment, false> impl_;
};
- CMake 3.17+
- C++ 11
- Git
- Conan, the C / C++ Package Manager (Python 3)
- Doxygen
We could build and run this project directly on your system.
- Download the source from GitHub with:
git clone https://github.com/arttet/tiny_utils.git
git clone [email protected]:arttet/tiny_utils.git
python -m pip install --upgrade conan
conan install . -s build_type=RelWithDebInfo -if build --build=outdated
conan build . -bf=build