Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 50 additions & 51 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,65 +13,64 @@ defaults:
jobs:
build:
runs-on: ubuntu-24.04
name: '${{ matrix.sys.compiler }} ${{ matrix.sys.version }}'
name: "${{ matrix.sys.compiler }} ${{ matrix.sys.version }}"
strategy:
matrix:
sys:
- { compiler: 'gcc', version: '11' }
- { compiler: 'gcc', version: '12' }
- { compiler: 'gcc', version: '13' }
- { compiler: 'gcc', version: '14' }
- { compiler: 'clang', version: '17' }
- { compiler: 'clang', version: '18' }
- { compiler: 'clang', version: '19' }
- { compiler: 'clang', version: '20' }
- { compiler: "gcc", version: "11" }
- { compiler: "gcc", version: "12" }
- { compiler: "gcc", version: "13" }
- { compiler: "gcc", version: "14" }
- { compiler: "clang", version: "17" }
- { compiler: "clang", version: "18" }
- { compiler: "clang", version: "19" }
- { compiler: "clang", version: "20" }

steps:
- name: Install GCC
if: matrix.sys.compiler == 'gcc'
uses: egor-tensin/setup-gcc@v1
with:
version: ${{matrix.sys.version}}
platform: x64
- name: Install GCC
if: matrix.sys.compiler == 'gcc'
uses: egor-tensin/setup-gcc@v1
with:
version: ${{matrix.sys.version}}
platform: x64

- name: Install LLVM and Clang
if: matrix.sys.compiler == 'clang'
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${{matrix.sys.version}}
sudo apt-get install -y clang-tools-${{matrix.sys.version}}
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{matrix.sys.version}} 200
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{matrix.sys.version}} 200
sudo update-alternatives --install /usr/bin/clang-scan-deps clang-scan-deps /usr/bin/clang-scan-deps-${{matrix.sys.version}} 200
sudo update-alternatives --set clang /usr/bin/clang-${{matrix.sys.version}}
sudo update-alternatives --set clang++ /usr/bin/clang++-${{matrix.sys.version}}
sudo update-alternatives --set clang-scan-deps /usr/bin/clang-scan-deps-${{matrix.sys.version}}
- name: Install LLVM and Clang
if: matrix.sys.compiler == 'clang'
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${{matrix.sys.version}}
sudo apt-get install -y clang-tools-${{matrix.sys.version}}
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{matrix.sys.version}} 200
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{matrix.sys.version}} 200
sudo update-alternatives --install /usr/bin/clang-scan-deps clang-scan-deps /usr/bin/clang-scan-deps-${{matrix.sys.version}} 200
sudo update-alternatives --set clang /usr/bin/clang-${{matrix.sys.version}}
sudo update-alternatives --set clang++ /usr/bin/clang++-${{matrix.sys.version}}
sudo update-alternatives --set clang-scan-deps /usr/bin/clang-scan-deps-${{matrix.sys.version}}

- name: Checkout code
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3

- name: Set mamba environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-dev.yml
cache-environment: true
- name: Set mamba environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-dev.yml
cache-environment: true

- name: Configure
run: |
if [[ "${{matrix.sys.compiler}}" = "gcc" ]]; then export CC=gcc-${{matrix.sys.version}}; export CXX=g++-${{matrix.sys.version}}; else export CC=clang; export CXX=clang++; fi
mkdir -p build
cd build
cmake .. -DBUILD_TESTS=ON \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_CXX_COMPILER=$CXX \
-G Ninja
- name: Configure
run: |
if [[ "${{matrix.sys.compiler}}" = "gcc" ]]; then export CC=gcc-${{matrix.sys.version}}; export CXX=g++-${{matrix.sys.version}}; else export CC=clang; export CXX=clang++; fi
mkdir -p build
cd build
cmake .. -DBUILD_TESTS=ON \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_CXX_COMPILER=$CXX \
-G Ninja

- name: Build
run: ninja -C build test_xtl

- name: Test
run: |
cd build/test
./test_xtl
- name: Build
run: ninja -C build test_xtl

- name: Test
run: |
cd build/test
./test_xtl
47 changes: 23 additions & 24 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,35 @@ jobs:
strategy:
matrix:
os:
- 13
- 14
- 15
- 26
runs-on: macos-${{ matrix.os }}
name: 'macos-${{ matrix.os }}'
name: "macos-${{ matrix.os }}"

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3

- name: Set mamba environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-dev.yml
cache-environment: true
- name: Set mamba environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-dev.yml
cache-environment: true

- name: Configure
shell: bash -l {0}
run: |
mkdir -p build
cd build
cmake .. -DBUILD_TESTS=ON \
-GNinja
- name: Configure
shell: bash -l {0}
run: |
mkdir -p build
cd build
cmake .. -DBUILD_TESTS=ON \
-GNinja

- name: Build
shell: bash -l {0}
run: ninja -C build test_xtl

- name: Test
run: |
cd build/test
./test_xtl
- name: Build
shell: bash -l {0}
run: ninja -C build test_xtl

- name: Test
run: |
cd build/test
./test_xtl
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ project(xtl)

set(XTL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)

# Enforce C++20
if(DEFINED CMAKE_CXX_STANDARD)
if(CMAKE_CXX_STANDARD LESS 20)
message(FATAL_ERROR "xtl requires at least C++20")
endif()
else()
set(CMAKE_CXX_STANDARD 20)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Versioning
# ===========

Expand Down
7 changes: 4 additions & 3 deletions include/xtl/xbasic_fixed_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ namespace xtl
struct select_storage<buffer | store_size>
{
template <class T, std::size_t N>
using type = typename select_fixed_storage<T[N + 1], N < (1u << (8 * sizeof(T)))>::type;
using type = typename select_fixed_storage<T[N + 1], N < (1ull << (8 * sizeof(T)))>::type;
};

template <>
Expand Down Expand Up @@ -916,8 +916,9 @@ namespace xtl
template <class InputIt>
inline auto xbasic_fixed_string<CT, N, ST, EP, TR>::assign(InputIt first, InputIt last) -> self_type&
{
m_storage.set_size(error_policy::check_size(static_cast<size_type>(std::distance(first, last))));
std::copy(first, last, data());
auto size = error_policy::check_size(static_cast<size_type>(std::distance(first, last)));
m_storage.set_size(size);
std::copy_n(first, m_storage.size(), data());
return *this;
}

Expand Down
Loading
Loading