https://github.com/414owen/typedef-gen
Alias all the types!
https://github.com/414owen/typedef-gen
aliases cpp typedef
Last synced: over 1 year ago
JSON representation
Alias all the types!
- Host: GitHub
- URL: https://github.com/414owen/typedef-gen
- Owner: 414owen
- Created: 2018-02-22T02:03:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-12-24T17:11:11.000Z (over 7 years ago)
- Last Synced: 2025-02-03T13:27:11.068Z (over 1 year ago)
- Topics: aliases, cpp, typedef
- Language: C++
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Typedef-Gen
Generate typedefs programatically from a grammar file.
## WARNING
HUGELY EXPONENTIAL OUTPUT SIZE GROWTH. MAY FILL YOUR HARDDRIVE WITH TYPEDEFS IF
YOU WRITE A BAD GRAMMAR FILE OR USE LOTS OF LAYERS.
## Requirements
* g++
* make
* boost
## To build
```
make
```
## To run
```
./alias [ [ []]]
# eg.
./alias 2 grammar out
# or
./alias
```
## Sample output
```
typedef std::vector vc;
typedef std::vector vi;
typedef std::vector vll;
typedef std::map mcc;
typedef std::map mic;
...
typedef std::vector vvc;
typedef std::vector vvi;
typedef std::vector vvll;
...
typedef std::map mmcivc;
typedef std::map mmiivc;
...
and so on, all the way down to those master of types:
typedef std::tuple ttclllltlllllltllllll;
typedef std::tuple ttilllltlllllltllllll;
typedef std::tuple ttlllllltlllllltllllll;
```
## Notes
Naming conflicts are possible, for example, with this grammar file:
```
#include
long long -> ll
unsigned -> u
unsigned long long -> ull
std::tuple<2-3> t
```
### tl;dr
Rename `u` or `ull` so `ull` doesn't start with the former.
### Explanation
This is because `tullu` could mean `tuple`, or
`tuple` (notice the extra comma). The solution to
this is not to abbreviations that start with the whole of another abbreviation
(in this exmaple `ull` starts with `u`) in grammars which generate
multiple-arity template arguments (tuple can have two or three parameters).