Skip to content

C++11 library. Small vector. Static vector. Small flat map/set. Static flat map/set. Compact vector. Segmented vector/devector.

License

Notifications You must be signed in to change notification settings

slavenf/sfl-library

Repository files navigation

sfl library

This is header-only C++11 library that offers several new or less-known containers:

Requirements

This library requires C++11 compiler or newer.

If available, the library uses the features of the newer C++ standards.

Tested compilers:

  • GCC 4.8.5 on CentOS 7 (C++11)
  • Clang 3.4.2 on CentOS 7 (C++11)
  • GCC 7.3.1 on CentOS 7 (C++11, 14, 17)
  • Clang 5.0.1 on CentOS 7 (C++11, 14, 17)
  • GCC 14.1.1 on Arch Linux (C++11, 14, 17, 20, 23)
  • Clang 18.1.8 on Arch Linux (C++11, 14, 17, 20, 23)
  • MSVC 19.38 (C++14, 17, 20, latest)

Installation and usage

Method 1: Manual copy-paste

Copy subdirectory sfl from directory include into your project directory and #include what you need.

Method 2: CMake integration

This library can be integrated into CMake project using CMake module FetchContent.

Step 1: Add the following lines into your CMakeLists.txt:

include(FetchContent)

FetchContent_Declare(
    sfl
    GIT_REPOSITORY https://github.com/slavenf/sfl-library)

FetchContent_MakeAvailable(sfl)

Step 2: Add this library as a dependency to your executable or library:

target_link_libraries(your_target_name PRIVATE sfl)

Step 3: #include what you need.

Exceptions

This library by default throw exceptions in case of error.

If macro SFL_NO_EXCEPTIONS is defined then library avoids using exceptions and calls std::abort in case of error.

This library does not automatically detect whether the compiler is invoked with appropriate flag or not, like -fno-exceptions in GCC and Clang.

Debugging

This library extensively uses macro assert from header <cassert>.

The definition of the macro assert depends on another macro, NDEBUG, which is not defined by the standard library.

If macro NDEBUG is defined then assert does nothing.

If macro NDEBUG is not defined then assert performs check. If check fails, assert outputs implementation-specific diagnostic information on the standard error output and calls std::abort.

Detailed documentation

The detailed documentation is located in directory doc. The detailed documentation is handwritten in Markdown format, it is not automatically generated with tools like Doxygen, so there may be some errors or mistakes. If you find one, please report it.

Tests

Test programs and scripts are located in directory test.

Tested compilers are listed in section Requirements.

Each test program is checked with Valgrind tool.

License

Licensed under zlib license. The license text is in file LICENSE.txt.

About

C++11 library. Small vector. Static vector. Small flat map/set. Static flat map/set. Compact vector. Segmented vector/devector.

Topics

Resources

License

Stars

Watchers

Forks

Languages