Skip to content

lyrahgames/xstd-cpp

Repository files navigation

xstd - C++ Extensions and Utilities

xstd is a C++ utility library that extends the STL with practical helpers and ergonomic abstractions to reduce boilerplate and speed up application prototyping. It is designed to feel like a natural extension of the standard library while staying simple, explicit, and easy to adopt.

top-language-badge code-size-badge repo-size-badge license-badge

GitHub commit activity GitHub last commit (by committer) GitHub tag (with filter)

Requirements and Dependencies

xstd uses the standard build2 CI service to build and test its source code with a variety of build configurations. For a thorough list of requirements, see the manifest file. To see detailed information about the current build status, set up xstd for development and run bdep ci.

xstd deliberately targets the newest C++ language standards and makes extensive use of recently standardized features. As such, it requires a modern C++ compiler with strong support for the latest standards (typically recent versions of Clang or GCC).

Getting Started

xstd relies on the build2 toolchain for building and dependency management. Install it via your system's package manager or follow the instructions in The build2 Installation Manual to build it from source. If you are new to build2, see The build2 Toolchain Introduction and The build2 Build System Manual for more information.

Usage in build2-Based Projects

  1. Add this repository to the repositories.manifest of your build2 project. To track the latest development version, append #main to the repository location.
:
role: prerequisite
location: https://github.com/lyrahgames/xstd-cpp.git
  1. In the manifest file of each build2 package that requires it, declare a dependency on libxstd. An optional version constraint may be specified.
depends: libxstd == 0.1.0
  1. In every buildfile that defines targets depending on xstd, import the library and add it as dependency.
import xstd = libxstd%lib{xstd}
exe{myexe}: {hxx cxx}{**} $xstd

Configuration

Currently, xstd does not expose any public configuration options.

Documentation

This README.md currently contains all project documentation. Additional documentation may be added in the future as the project evolves.

Usage, Examples, and Tutorials

No usage examples or tutorials are currently provided. They will be added as the library matures.

FAQs and HOWTOs

How to install or use xstd in projects not based on build2?

You can make a build2 package available for non-build2 projects by following these essential steps. For more information, consult The build2 Toolchain Introduction: Package Consumption and The build2 Toolchain Introduction: Using Unpackaged Dependencies.

  1. Create a build configuration for C/C++-based build2 packages.
bpkg create -d build2-packages cc \
  config.cxx=g++ \
  config.cc.coptions="-O3 -march=native" \
  config.install.root=/usr/local \
  config.install.sudo=sudo
  1. Fetch the repository's packages and build them.
bpkg build https://github.com/lyrahgames/xstd-cpp.git
  1. Install the built package.
bpkg install libxstd
  1. Optionally, uninstall the built packages when you do not need them any longer.
bpkg uninstall libxstd
  1. To upgrade the package, fetch all new information and uninstall the older version. Afterwards, build the new version and install it.
bpkg fetch
bpkg status

bpkg uninstall libxstd
bpkg build libxstd
bpkg install libxstd

How to set up xstd for development?

These steps prepare the repository for development. Familiarity with build2 is recommended. For full details, see The build2 Toolchain Introduction.

  1. Clone the repository.
git clone https://github.com/lyrahgames/xstd-cpp.git
cd xstd-cpp
  1. Use bdep to create the initial build configuration. If not stated otherwise, it will be placed within the previously created project-specific directory. For example, the command below shows how to create and initialize a configuration named gcc-release with installation and distribution support.
bdep init -C @gcc-release cc \
  config.cxx=g++ \
  config.cxx.coptions="-O3 -march=native" \
  config.install.root=../.install \
  config.dist.root=../.dist
  1. Common Development Tasks
  • Use bdep to print the status of project packages and their immediate dependencies.
bdep status -i
  • Use b to build and test the source code.
b                      # Build all the code.
b test                 # Only build and run the tests.
b {clean update}       # Clean build all the code.
b {clean update test}  # Clean build all the code and run the tests.
  • Similarly, to build and test the source in a specific build configuration with bdep, run the following commands.
bdep update @gcc-release
bdep test @gcc-release
bdep clean @gcc-release
  • Use b to test the installation of the project. In the example configuration gcc-release created above, the installation directory .install is part of the development folder.
b install
b uninstall
  • Use b to test the distribution of the project's packages. In the example configuration gcc-release created above, the directory for distributions .dist is part of the development folder.
b dist: libxstd
bdep ci

API Reference

A formal API reference is not yet available. For now, you can explore the library’s source files directly. The inline comments provide guidance on the API usage and implementation details.

Changelog

All notable changes to this project are documented in CHANGELOG.md. The changelog follows the Keep a Changelog and Common Changelog formats. This project also adheres to Semantic Versioning to clearly communicate version changes and compatibility.

Contributing

Contributions are welcome and greatly appreciated! Please start by opening an issue to report a bug or suggest an improvement. This helps us coordinate efforts and avoid duplicate work. You are then welcome to submit a pull request that references the issue.

Copyright and License

The copyright for the code is held by the contributors of the code. The revision history in the version control system is the primary source of authorship information for copyright purposes. Please see individual source files for appropriate copyright notices. For more information, see the file AUTHORS.md.

xstd is free software, distributed under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License (or any later version). For more information, see the GNU General Public License or the file COPYING.md.

xstd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Copyright years on xstd source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.

References and Other Resources

About

C++ Extensions and Utilities for Faster Prototyping

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published