Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
Update premake file to be able to use different cpp dialects
  • Loading branch information
KredeGC committed Jan 16, 2023
1 parent 566080f commit 26e9b66
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
strategy:
matrix:
config: [debug, release]
dialect: [C++17, C++20]
machine:
- host: linux
os: ubuntu-latest
Expand Down Expand Up @@ -53,7 +54,7 @@ jobs:
with:
languages: cpp
- name: Build
run: premake5 build --config=${{ matrix.config }}
run: premake5 build --config=${{ matrix.config }} --dialect=${{ matrix.dialect }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Run test
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ A C++ library containing various composite memory allocators and containers.<br/
Allocators are mostly based on a [Talk by Andrei Alexandrescu](https://www.youtube.com/watch?v=LIb3L4vKZ7U).

[![Release](https://img.shields.io/github/v/release/KredeGC/KTL?display_name=tag&style=flat-square)](https://github.com/KredeGC/KTL/releases)
[![Size](https://img.shields.io/github/languages/code-size/KredeGC/KTL?style=flat-square)](https://github.com/KredeGC/KTL/issues)
[![License](https://img.shields.io/github/license/KredeGC/KTL?style=flat-square)](https://github.com/KredeGC/KTL/blob/master/LICENSE)

[![Issues](https://img.shields.io/github/issues/KredeGC/KTL?style=flat-square)](https://github.com/KredeGC/KTL/issues)
[![Tests](https://img.shields.io/github/actions/workflow/status/KredeGC/KTL/main.yml?branch=master&style=flat-square)](https://github.com/KredeGC/KTL/actions/workflows/main.yml)

Expand All @@ -22,6 +24,7 @@ For now thread safety is not on the roadmap as it would degrade performance on s
The functionality itself is fairly stable but should not be expected to be used in a production environment for the time being.

# Table of Content
* [Compatibility](#compatibility)
* [Installation](#installation)
* [Usage](#usage)
* [Allocators](#allocators)
Expand All @@ -35,13 +38,16 @@ The functionality itself is fairly stable but should not be expected to be used
* [Allocator examples](#allocator-examples)
* [Building and running tests](#building-and-running-tests)

# Compatibility
This library was made with C++17 in mind and may or may not be compatible with earlier versions.
Backwards compatability is currently not on the roadmap, but pull requests which try to fix such issues are welcome.

# Installation
As this is a header-only library, you can simply copy the header files directly into your project.
The header files can either be downloaded from the [releases page](https://github.com/KredeGC/KTL/releases) or from the [`include/`](https://github.com/KredeGC/KTL/tree/master/include/ktl) directory on the master branch.
The source and header files inside the `src/` directory are only tests and should not be included into your project.

# Usage
This library was made with C++17 in mind and may or may not be compatible with earlier versions.
The library has 3 main files that you can include into your application.
* [`ktl/ktl.h`](https://github.com/KredeGC/KTL/tree/master/include/ktl/ktl.h) - Includes everything into this translation unit
* [`ktl/ktl_alloc_fwd.h`](https://github.com/KredeGC/KTL/tree/master/include/ktl/ktl_alloc_fwd.h) - Includes forward declarations for all the allocators
Expand Down Expand Up @@ -102,7 +108,7 @@ This library also contains various containers that are STL compliant.
| [trivial_array<br/>\<T, Alloc\>](#trivial_array-interface) | An array wrapper class, similar to `std::array`, but uses dynamic allocation and is optimized for trivial types. Takes a type `T` and an allocator `Alloc`. | The container uses a straight `memcpy` for most of its operations.<br/>It's not recommended to use this with non-trivial types, eg. types that have custom default, copy or move constructors or custom destructors.<br/>Just like with the standard array, the container may invalidate iterators and references on insertion, but not on erasure. |
| [trivial_vector<br/>\<T, Alloc\>](#trivial_vector-interface) | A vector class, similar to `std::vector`, but optimized for trivial types. Takes a type `T` and an allocator `Alloc`. | The container uses a straight `memcpy` for most of its operations.<br/>It's not recommended to use this with non-trivial types, eg. types that have custom default, copy or move constructors or custom destructors.<br/>Just like with the standard vector, the container may invalidate iterators and references on insertion, but not on erasure. |
| [unordered_map<br/><K, V, Hash, EqualTo, Alloc>](#unordered_map-interface) | A hash map class similar to `std::unordered_map`, but optimized for cache locality using open addressing with linear probing. | The container uses a `Hash` struct, `EqualTo` struct and `Alloc` class passed in as template parameters, just like the standard unordered map.<br/>Unlike `std::unordered_map` iterator and reference invalidation may happen on insertion. However, only iterators and references to the erased object are invalidated on erasure. |
| [unordered_multi_map<br/><K, V, Hash, EqualTo, Alloc>](#unordered_multimap-interface) | A hash multimap class similar to `std::unordered_multimap`, but optimized for cache locality using open addressing with linear probing. | The container uses a `Hash` struct, `EqualTo` struct and `Alloc` class passed in as template parameters, just like the standard unordered map.<br/>Unlike `std::unordered_multimap` iterator and reference invalidation may happen on insertion. However, only iterators and references to the erased object are invalidated on erasure. |
| [unordered_multimap<br/><K, V, Hash, EqualTo, Alloc>](#unordered_multimap-interface) | A hash multimap class similar to `std::unordered_multimap`, but optimized for cache locality using open addressing with linear probing. | The container uses a `Hash` struct, `EqualTo` struct and `Alloc` class passed in as template parameters, just like the standard unordered map.<br/>Unlike `std::unordered_multimap` iterator and reference invalidation may happen on insertion. However, only iterators and references to the erased object are invalidated on erasure. |

## binary_heap interface
| Method | Description |
Expand Down
9 changes: 8 additions & 1 deletion premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ newoption {
}
}

newoption {
trigger = "dialect",
value = "Dialect (eg. C++17, C++20)",
description = "The dialect to use when generating project files",
default = "C++17",
}

require "scripts/build"
require "scripts/test"

Expand All @@ -42,7 +49,7 @@ outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
project "Test"
kind "ConsoleApp"
language "C++"
cppdialect "C++17"
cppdialect(_OPTIONS["dialect"])
staticruntime "off"

targetdir ("bin/%{outputdir}")
Expand Down

0 comments on commit 26e9b66

Please sign in to comment.