https://github.com/avitase/static_rotation
C++ header-only library that uses TMP to generate all rotations of a given integral sequence at compile-time.
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (5.5%) to scientific vocabulary
Keywords
Repository
C++ header-only library that uses TMP to generate all rotations of a given integral sequence at compile-time.
Basic Info
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
static_rotation
static_rotation is a header-only library that uses template meta programming to generate all rotations of a given integer sequence at compile-time.
Example
The snippet below generates all rotations of the sequence (0,1,2,3) and stores them in a std::array<std::size_t, 16>:
```
include "static_rotation.hpp"
include
int main() { using namespace static_rotation; using R = IndexRotations<4>; constexpr auto values = R::values;
for (int i = 0; i < values.size(); i++) {
std::cout << values[i];
std::cout << (i % R::seq_length == R::seq_length - 1 ? '\n' : ' ');
}
}
The output of this snippet is
0 1 2 3
1 2 3 0
2 3 0 1
3 0 1 2
```
You can run the snippet on Compiler Explorer: godbolt.org/z/uNmXFr
IndexRotations<N> generates the rotations for an index sequence (0, 1, 2, ..., N). If the rotations for arbitrary sequences are needed, one may use Rotations directly, e.g.
Rotations<int, 4, 8, 15, 16, 23, 42>;
see godbolt.org/z/fWeikA for a complete example.
For more details take a look at static_rotation.hpp.
Installatation
This library is header-only and including static_rotation.hpp is sufficient.
Requirements
The library uses C++17 features. No external libraries are needed.
Owner
- Name: Nis Meinert
- Login: avitase
- Kind: user
- Company: Pasteur Labs
- Repositories: 9
- Profile: https://github.com/avitase
GitHub Events
Total
Last Year
Issues and Pull Requests
Last synced: 11 months ago