Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
lackhole committed Jun 15, 2024
1 parent 68dcc23 commit cf8b96a
Showing 1 changed file with 61 additions and 4 deletions.
65 changes: 61 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,65 @@
![logo.png](logo.png)

## Description
Use the latest STL implementation in C++14

(Code migration in progress)
**Use the latest STL implementation in C++14**

```c++
// All implementation is written under C++14 standard
#include "preview/ranges.h"

auto map = preview::views::iota('A', 'E') |
preview::views::enumerate |
preview::ranges::to<std::map>();

std::cout << map[0] << ' '
<< map[1] << ' '
<< map[2] << '\n';
// A B C
```

**`preview` is standard-conforming, and is compatible with existing STL**
```c++
auto r = preview::views::iota(0) |
preview::views::take(10) |
preview::views::filter([](auto x) { return x % 2 == 0; });

// Compatible with both pre C++20 and post C++20 std::iterator_traits
static_assert(std::is_same<
std::iterator_traits<decltype(r.begin())>::reference,
int
>::value, "");
// Others such as std::get, std::tuple_size are also compatible
```
**Up to C++26 STL are available**
```c++
void foo(preview::span<int>) {}
int main() {
// span with C++26 standard
foo({1, 2, 3});
preview::variant<int, float, double> v{1.0f};
v.visit([](auto x) {
// member visit(): C++26 standard
});
// views::concat
std::vector<char> v = {'h', 'e', 'l'};
std::string s = "lo, ";
preview::string_view sv = "world";
std::list<char> l = {'!'};
for (auto c : preview::views::concat(v, s, sv, l)) {
std::cout << c;
}
// hello, world!
}
```

## Compiler Support
[![Build Status](https://github.com/lackhole/stl-preview/actions/workflows/cmake-multi-platform.yml/badge.svg)](https://github.com/lackhole/stl-preview/actions/workflows/cmake-multi-platform.yml)

| Compiler | Minimum version tested | Maximum version tested |
|-------------|---------------------------------------|---------------------------------------|
Expand All @@ -22,7 +76,10 @@ Use the latest STL implementation in C++14
Description
* ![](https://img.shields.io/badge/C++XX-C++YY-CCEEFF): C++YY standard implemented in C++XX
* ![](https://img.shields.io/badge/C++YY-red): C++YY standard, not implemented yet

* If the implementation is impossible(i.e., needs compiler support / hardware info) it is marked as **N/A**
* Some features are working in progress
* **Introduced**: First introduced version
* **Revision**: Behavior changed/updated version

-----

Expand Down

0 comments on commit cf8b96a

Please sign in to comment.