https://github.com/dimitrisjim/typelist
Typelist implementation using C++ metaprogramming
https://github.com/dimitrisjim/typelist
Last synced: 2 months ago
JSON representation
Typelist implementation using C++ metaprogramming
- Host: GitHub
- URL: https://github.com/dimitrisjim/typelist
- Owner: DimitrisJim
- License: mit
- Created: 2019-09-24T14:42:30.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-11T15:13:03.000Z (over 5 years ago)
- Last Synced: 2025-01-25T10:28:22.919Z (4 months ago)
- Language: C++
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TypeList
[](https://travis-ci.com/DimitrisJim/TypeList)
[](http://www.wtfpl.net/)
[]()A compile time linked-list like data structure that facilitates the manipulation of C++ types. Implemented using template classes and supporting similar operations as found in runtime equivalent structures.
Based on [Modern C++ Design](https://www.amazon.com/Modern-Design-Generic-Programming-Patterns/dp/0201704315) implementation.
## Operations:
Name | Arguments | Description
-----|-----------|------------
`Create` | `... Types`: A variable number of types. | Creates a new Typelist out of the given arguments in `Types`. Allows the inclusion of any value. E.g `Create`.
`Length` | `Typelist`: The typelist for which length is calculated. | Recurses through the typelist counting the number of types contained. The end `Sentinel` is not counted.
`TypeAt` | `Typelist, index`: The typelist and the index of the item in it. | Recurses through typelist until type with index `index` is found. Lack of specialization results in compile time error if out of bounds.
`Pop` | `Typelist`: The typelist from which we pop the last item and return it. | Recurses and removes last item from the typelist.
`Count` | `Typelist, T`: Count occurrences of T in typelist | Recurces through typelist incrementally counting the number of times type `T` is contained.
`Append` | `Typelist, T`: Appends the type `T` at the end of the typelist. | Returns a new typelist containing the type `T` as the final type.
`Contains` | `Typelist, T`: Checks for membership. | Not strictly necessary, literally wraps `Count`.