![]() |
VCTR
|
A powerful C++ 20 wrapper around your favorite standard library containers.
VCTR is a header-only library. The easiest way to use it is to add it as a git submodule to your project:
After doing so, you can simply add it to your project using the add_subdirectory
command and link against the sonible::vctr
target:
To use it in your project, include the vcrt/vctr.h
header:
Finally, export the CMake project and built it:
In most cases you simply want to #include <vctr/vctr.h>
. If you only want to access the forward declarations of the public types you can #include <vctr/vctr_forward_declarations.h>
as a lightweight alternative.
It is also possible to access a demo project that showcases some of VCTR's features. For doing so, export the project using the -D VCTR_BUILD_DEMO=1
CMake option after cloning:
VCTR is using cutting-edge C++ library features and needs a very recent compiler to work properly. It is currently tested with the following compilers:
In order to achieve high performance, VCTR uses two platform specific vector operation libraries, these are:
On Apple systems the Accelerate framework is a required dependency. If you are using VCTR using CMake, the framework will be linked and used automatically; no configuration is necessary.
Intel IPP is an optional dependency that is available on Intel (x64) systems.
To install IPP, please follow the instructions on the website or install it using python: pip3 install ipp-static
.
Next, use the VCTR_USE_IPP=1
CMake option to instruct the project to link against IPP.
VCTR will look for the required headers and libraries in common locations. In case you use a non-standard location, you can pass its location using the VCTR_IPP_ROOT
command line option when exporting the project:
The documentation up until this point assumes that VCTR is used in a CMake-based project. If you however use a different setup, you can follow the steps below to use this library:
include
folder to your header search path.Accelerate
framework.In case you want to enable IPP support:
ipp.h
can be found.ippcore(mt)
, ipps(mt)
and ippvm(mt)
.Note that VCTR will try to use IPP as soon as it can resolve the ipp.h
header. In case you want to disable IPP even if the headers are available, define the VCTR_USE_IPP
preprocessor flag to 0
.
If you are using VCTR in the context of a JUCE project that does not yet use CMake, you can treat include/vctr
as a JUCE module.
In Projucer, add this directory using the +
button in the Modules
tab and select Add a module from a specific folder
. After doing so, you can use it as shown in the example at the beginning of this document.
The project is currently under development. Contributions to the project are highly appreciated, just have a look at the issue section to find open issues. We'll add a contribution guideline to this repository soon.
VCTR's unit tests, located in the test
subfolder, are dependent on Catch2 and gcem. To create the unit test target, run cmake with the -DVCTR_BUILD_TEST=1``. In case you want to integrate the VCTR unit test cases into your own catch2 based unit tests, you can define
VCTR_EXPOSE_UNIT_TEST_CASES_TARGETto 1 and link against the
sonible::vctr_test_targets` target which contains all test cases.
The preferred method of installing the dependencies is using the C++ package manager conan. If conan
is available on your system, export the project using the VCTR_USE_CONAN=1
and VCTR_BUILD_TEST=1
options:
In case conan is not used, the dependencies need to be installed manually on the system. Please consult the project's documentation for details.
The minimal steps include the following:
(This section is still under development, more infos will follow)
snake_case
headers are intended to be included by the user, CamelCase
headers are implementation details and cannot be included on their own.#include <vctr_utils/...>
supply additional utility functions that are not strictly relevant to the core functionality of the VCTR project. They are used in the test, benchmark, and demo projects and might have additional third party dependencies.#include <vctr_test_utils/...>
supply additional utility functions that are useful especially for Catch2-based tests. They depend on having Catch2 greater version 3.0.0 available. If you are writing Catch2 based unit tests, you might be especially interested in the matchers that can be accessed via #include <vctr_test_utils/vctr_catch_matchers.h>
.(This section is still under development, more infos will follow)
This section explains some commonly used names and concepts that are used throughout the project.
The extent definition is basically taken from std::span
. In all situations where the size of a container, a view, or an expression is known at compile time, the extent will equal the size. In cases where the size is only known at runtime, the extent will equal std::dynamic_extent
which in turn is defined to std::numeric_limits<size_t>::max()
on all platforms we know. A Span
might have both, a dynamic and a non-dynamic extent. A Vector
will always have a dynamic extent. An Array
will always have a non-dynamic extent. Expressions will inherit the extent of their source(s).
VCTR is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3 (LGPLv3) only, as published by the Free Software Foundation.
This basically implies, in legally non-binding terms:
Please find the full licensing terms and conditions in the LICENSE file.