/tiny_utils

A header-only library of modern C++ idioms

Primary LanguageC++MIT LicenseMIT

TinyUtils

Build Status

A header-only library of modern C++ idioms

For example:

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_;
};

Requirements

Installation

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 git@github.com:arttet/tiny_utils.git

Install requirements

python -m pip install --upgrade conan

Install dependencies

conan install . -s build_type=RelWithDebInfo -if build --build=outdated

Build

conan build . -bf=build