Skip to content

Commit

Permalink
Merge pull request #43 from wusatosi/ref-impl
Browse files Browse the repository at this point in the history
Switch Implementation
  • Loading branch information
wusatosi authored Dec 3, 2024
2 parents 34ddede + 40d3378 commit 2b0bb62
Show file tree
Hide file tree
Showing 8 changed files with 2,139 additions and 714 deletions.
1 change: 1 addition & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
claus
moint
34 changes: 28 additions & 6 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
platform: [ubuntu-24.04]
compiler:
- cpp: g++
c: gcc
- cpp: clang++
c: clang
cpp_version: [17, 20, 23, 26]
cpp_version: [23]
cmake_args:
- description: "Default"
args: ""
Expand All @@ -46,16 +46,22 @@ jobs:
- description: "ASan"
args: "-DCMAKE_CXX_FLAGS='-fsanitize=address -fsanitize=undefined'"
include:
# Needs C++ 20 as C++17 selectivly disables ranges and concepts
# related functionalities
- platform: ubuntu-latest
- platform: ubuntu-24.04
compiler:
cpp: g++
c: gcc
cpp_version: 20
cpp_version: 23
cmake_args:
description: "Werror"
args: "-DCMAKE_CXX_FLAGS='-Wall -Wextra -Wpedantic -Werror'"
- platform: ubuntu-24.04
compiler:
cpp: g++
c: gcc
cpp_version: 23
cmake_args:
description: "Dynamic"
cmake_args: "-DBUILD_SHARED_LIBS=on"

name: "Build & Test: ${{ matrix.compiler.c }} ${{ matrix.cpp_version }} ${{ matrix.cmake_args.description }}"
runs-on: ${{ matrix.platform }}
Expand All @@ -66,6 +72,22 @@ jobs:
with:
cmakeVersion: "~3.25.0"
ninjaVersion: "^1.11.1"
- name: Install latest compiler
run: |
if [ "${{ matrix.compiler.cpp}}" == "g++" ]; then
# Install gcc-14
sudo apt-get update
sudo apt-get install -y gcc-14 g++-14
sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-14 /usr/bin/gcc
sudo rm /usr/bin/g++
sudo ln -s /usr/bin/g++-14 /usr/bin/g++
else
# Install llvm
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
fi
- name: Print installed software
run: |
clang++ --version
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ which dynamic memory allocations are undesired.

#include <beman/inplace_vector/inplace_vector.hpp>

using namespace beman::inplace_vector;
using namespace beman;

/**
* Generates fibonacci sequence using inplace_vector.
Expand All @@ -56,7 +56,7 @@ template <int Capacity> inplace_vector<int, Capacity> fibonacci_to(int num) {
### Compiler support
Building this repository requires **C++17** or later.
Building this repository requires **C++23** or later.
### Dependencies
Expand Down
2 changes: 1 addition & 1 deletion examples/fibonacci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <beman/inplace_vector/inplace_vector.hpp>

using namespace beman::inplace_vector;
using namespace beman;

/**
* Generates fibonacci sequence using inplace_vector.
Expand Down
1,649 changes: 945 additions & 704 deletions include/beman/inplace_vector/inplace_vector.hpp

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions tests/beman/inplace_vector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,14 @@ add_executable(beman.inplace_vector.test inplace_vector.test.cpp)
target_link_libraries(beman.inplace_vector.test PRIVATE beman.inplace_vector)

add_test(NAME beman.inplace_vector.test COMMAND beman.inplace_vector.test)

# Migrated test from original implementation
add_executable(beman.inplace_vector.ref-test ref_impl.test.cpp)
target_link_libraries(
beman.inplace_vector.ref-test
PRIVATE beman.inplace_vector
)
add_test(
NAME beman.inplace_vector.ref-test
COMMAND beman.inplace_vector.ref-test
)
3 changes: 2 additions & 1 deletion tests/beman/inplace_vector/inplace_vector.test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include <beman/inplace_vector/inplace_vector.hpp>
#include <cassert>

using namespace beman::inplace_vector;
using namespace beman;

template <typename T> constexpr void test() {
using vec = inplace_vector<T, 42>;
Expand Down
Loading

0 comments on commit 2b0bb62

Please sign in to comment.