utempl/README.md

35 lines
933 B
Markdown
Raw Permalink Normal View History

2024-02-22 15:19:01 +00:00
# uTempl - Modern C++ Template Library
## Features
2024-03-28 19:24:30 +00:00
### Ranges Like Interface For TupleLike
```cpp
2024-07-31 02:22:33 +00:00
import utempl;
2024-03-28 19:24:30 +00:00
auto main() -> int {
using namespace utempl;
2024-03-29 20:18:06 +00:00
constexpr TupleLike auto tuple = Tuple{1, 2, 3, 4, 5, 6}
2024-03-28 19:24:30 +00:00
| Take<5>()
| Map([](int arg){return arg + 1;})
| Map([](int arg) -> float {return arg;})
| Reverse()
| Take<3>(); // Lazy evaluate
static_assert(tuple == Tuple{6.0f, 5.0f, 4.0f});
};
```
### Storage types in array
```cpp
2024-07-31 02:22:33 +00:00
import utempl;
import std;
2024-03-28 19:24:30 +00:00
auto main() -> int {
using namespace utempl;
constexpr std::array types{kTypeId<int>, kTypeId<void>};
static_assert(std::is_same_v<GetMetaInfo<types[0]>::Type, int>);
static_assert(std::is_same_v<GetMetaInfo<types[1]>::Type, void>);
2024-04-18 23:40:12 +00:00
static_assert(std::is_same_v<decltype(GetTypeListForTag()), TypeList<int, void>>);
2024-03-28 19:24:30 +00:00
};
```
2024-02-22 15:19:01 +00:00
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.