Skip to content
Merged
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
156 changes: 156 additions & 0 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
#
# Copyright (c) 2025 Gennaro Prota (gennaro dot prota at gmail dot com)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#
# Official repository: https://github.com/boostorg/static_string
#

name: Example (basic_static_cstring)

on:
pull_request:
push:
branches:
- master
- develop
- bugfix/**
- feature/**
- fix/**
- github/**
- pr/**
paths-ignore:
- LICENSE
- meta/**
- README.md

jobs:
linux:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- { toolset: gcc-13, cxxstd: '20,23' }
- { toolset: gcc-14, cxxstd: '20,23,26' }
- { toolset: clang-17, cxxstd: '20,23' }
- { toolset: clang-18, cxxstd: '20,23,26' }

steps:
- name: Checkout Boost super-project
uses: actions/checkout@v4
with:
repository: boostorg/boost
ref: develop
fetch-depth: 0

- name: Checkout this library
uses: actions/checkout@v4
with:
path: libs/static_string
fetch-depth: 0

- name: Initialize Boost submodules
run: |
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args '--jobs 4' static_string

- name: Bootstrap b2
run: ./bootstrap.sh

- name: Generate Boost headers
run: ./b2 headers

- name: Build and run example tests
run: |
./b2 libs/static_string/example/static_cstring \
toolset=${{ matrix.toolset }} \
cxxstd=${{ matrix.cxxstd }} \
variant=debug,release \
-j$(nproc)

macos:
runs-on: macos-14
strategy:
fail-fast: false
matrix:
include:
- { toolset: clang, cxxstd: '20,23' }

steps:
- name: Checkout Boost super-project
uses: actions/checkout@v4
with:
repository: boostorg/boost
ref: develop
fetch-depth: 0

- name: Checkout this library
uses: actions/checkout@v4
with:
path: libs/static_string
fetch-depth: 0

- name: Initialize Boost submodules
run: |
git submodule update --init tools/boostdep
python3 tools/boostdep/depinst/depinst.py --git_args '--jobs 4' static_string

- name: Bootstrap b2
run: ./bootstrap.sh

- name: Generate Boost headers
run: ./b2 headers

- name: Build and run example tests
run: |
./b2 libs/static_string/example/static_cstring \
toolset=${{ matrix.toolset }} \
cxxstd=${{ matrix.cxxstd }} \
variant=debug,release \
-j$(sysctl -n hw.ncpu)

windows:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
include:
- { toolset: msvc-14.3, cxxstd: '20,latest' }

steps:
- name: Checkout Boost super-project
uses: actions/checkout@v4
with:
repository: boostorg/boost
ref: develop
fetch-depth: 0

- name: Checkout this library
uses: actions/checkout@v4
with:
path: libs/static_string
fetch-depth: 0

- name: Initialize Boost submodules
run: |
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args '--jobs 4' static_string

- name: Bootstrap b2
run: .\bootstrap.bat
shell: cmd

- name: Generate Boost headers
run: .\b2 headers
shell: cmd

- name: Build and run example tests
run: |
.\b2 libs/static_string/example/static_cstring ^
toolset=${{ matrix.toolset }} ^
cxxstd=${{ matrix.cxxstd }} ^
variant=debug,release ^
address-model=64
shell: cmd
19 changes: 19 additions & 0 deletions example/static_cstring/Jamfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Copyright (c) 2025 Gennaro Prota (gennaro dot prota at gmail dot com)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#
# Official repository: https://github.com/boostorg/static_string
#

import testing ;

project
: requirements
<include>../../include
<warnings>extra
<cxxstd>20
;

run static_cstring_test.cpp ;
13 changes: 13 additions & 0 deletions example/static_cstring/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This directory contains an experimental implementation of `basic_static_cstring`, which differs from `basic_static_string` in the following ways:

| | `basic_static_cstring` | `basic_static_string` |
|---------------------|------------------------|-----------------------|
| Layout | `sizeof == N + 1` | Has size member |
| Embedded NULs | Not supported | Supported |
| Trivially copyable | Yes | No |

Additionally, when `N <= UCHAR_MAX`, `basic_static_cstring` employs an optimization that avoids calling `std::strlen()` to compute the size.

This work stems from [boostorg/static_string#23](https://github.com/boostorg/static_string/issues/23).

If you believe `basic_static_cstring` should become part of the public API, please share your feedback on the Boost mailing list.
Loading