Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/caffik/libutils
C++ header only library
https://github.com/caffik/libutils
cmake cpp cpp17 utility
Last synced: 26 days ago
JSON representation
C++ header only library
- Host: GitHub
- URL: https://github.com/caffik/libutils
- Owner: caffik
- Created: 2024-06-05T09:29:13.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-19T14:41:19.000Z (about 2 months ago)
- Last Synced: 2024-09-29T23:42:28.448Z (about 1 month ago)
- Topics: cmake, cpp, cpp17, utility
- Language: C++
- Homepage: https://caffik.github.io/libutils/
- Size: 217 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# libutils
## Overview
`libutils` is a C++ utility library that provides a set of useful functions and templates to simplify common programming
tasks. The library is designed to be lightweight and not difficult to integrate into various projects.### Requirements
- C++17 or later
- CMake 3.28 or later## Project Structure
- `docs/`: Contains the documentation for the library.
- `include/`: Contains the public headers for the library.
- `tests/`: Contains unit tests for the library.### Description
`libutils` includes the following header files:
- `utils/algorithm.hpp`: includes functions for finding the index of the maximum element in a range, copying a range of
elements multiple times, finding the first position where two ranges differ starting from the end, and reordering
elements in a range based on given indices. The file uses templates to work with different types of iterators and
predicates.- `utils/files.hpp`: provides functionality for reading the contents of a directory and filtering the paths based on a
given condition. It uses templates to allow flexibility in the types of containers and predicates used.- `utils/iterator.hpp`: provides utilities for working with iterators, including functions to advance multiple
iterators, compute distance differences between ranges, and determine the longer range between two ranges. It also
includes a MultiIterator class template for iterating over multiple iterators simultaneously.- `utils/numeric.hpp`: contains functions to compute the product and mean of a range of elements. These functions are
designed to work with various types of input iterators.- `utils/tuple.hpp`: provides utilities for working with tuples, including functions to move, swap, and copy elements
between tuples. It also includes a pointer_tuple class template that holds a tuple of pointers to elements, allowing
for operations on the elements pointed to by the pointers.- `utils/type_traits.hpp`: includes functionality for checking if a type has a push_back or insert method, removing
const, volatile, and reference qualifiers from a type, and invoking a series of functions on a copy of a given
argument.- `utils/utility.hpp`: provides general utility functions, such as a function to get a reference to a value or
dereferenced pointer and a function to execute a given function in a compile-time loop. These utilities are designed
to simplify common programming tasks and improve code readability.## Installation
### Using CMake:
To add `libutils` to your project, you can use CMake's `add_subdirectory` function. First, clone the repository:
```sh
git clone https://github.com/caffik/libutils.git
```Then, add the following lines to your `CMakeLists.txt`:
```cmake
add_subdirectory(libutils)
target_link_libraries(your_target PRIVATE libutils::main)
```It can be also added with `FetchContent`:
```cmake
include(FetchContent)
FetchContent_Declare(
libutils
GIT_REPOSITORY https://github.com/caffik/libutils.git
GIT_TAG v1.1.2
)
FetchContent_MakeAvailable(libutils)
```#### CMake options:
- `ENABLE_TESTING`: build the tests for the library (default: `OFF`)
- `ENABLE_DOCS`: build the documentation for the library (default: `OFF`)### Manual installation:
Clone the repository:
```sh
git clone https://github.com/caffik/libutils.git
```Add the `include` directory to your project's include path. Then include the desired header files in your source files:
```cpp
#include
#include
```## Documentation
The documentation is generated using Doxygen and Sphinx. It is built automatically by CMake.
Documentation page: [libutils](https://caffik.github.io/libutils/)
### Requirements:
- `breathe` (>= 4.35.0)
- `Doxygen` (>= 1.11.0)
- `sphinx` (>= 8.0.2)## Examples
Examples of how to use the library can be found on the library page.