Skip to content

cm-jones/libdsc

Repository files navigation

libdsc logo

libdsc

CI Codacy Badge Codecov License: GPL v3

libdsc is a free and open-source C library featuring generic implementations of various containers provided by the C++ Standard Library.

Features

libdsc currently reimplements the following containers:

Sequence containers

  • std::vector

  • std::forward_list

  • std::list

Unordered associative containers

  • std::unordered_map

  • std::unordered_set

Container adaptors

  • std::stack

  • std::queue

All of these (re)implementations are generic (can store any data type), memory-safe, and benchmarked against their counterparts in the C++ Standard Library.

See ROADMAP.md for a list of containers we plan to (re)implement in the future.

Installing from source

First, build the project:

mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_BENCHMARKS=OFF -DBUILD_EXAMPLES=OFF
make

Then, to install the library system-wide:

sudo make install

This will install:

  • Library files to /usr/local/lib

  • Header files to /usr/local/include/libdsc

  • CMake configuration files to /usr/local/lib/cmake/libdsc

Installing from package

On Debian-based Linux distributions (e.g., Debian, Ubuntu, Linux Mint):

sudo dpkg -i libdsc-*.deb

On RPM-based Linux distributions (e.g., Fedora, Red Hat):

Usage

Simply include the relevant headers in your project, like so:

#include <libdsc/vector.h>
#include <libdsc/list.h>

Complete examples can be found in the examples/ directory.

Testing

Google Test is used for unit testing. To run the tests, after building the project:

cd build
ctest --output-on-failure

Benchmarking

Google Benchmark is used to measure the performance of libdsc's containers against their equivalents in the C++ Standard Library. Benchmarks are run weekly automatically via GitHub Actions. You can also run the benchmarks locally:

Benchmarks are automatica

mkdir -p build
cd build
cmake .. -DBUILD_BENCHMARKS=ON
make
cd benchmarks
./benchmark_*

Contributing

Please read CONTRIBUTING.md carefully before you attempt to make any contributions to this project.

License

This project is licensed under the GPLv3. See LICENSE for details.