-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest.cpp
More file actions
34 lines (30 loc) · 847 Bytes
/
Copy pathtest.cpp
File metadata and controls
34 lines (30 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "allstd.hpp" // this is required to work by [std.modules]/4
#include <version>
import std;
#ifdef __GLIBCXX__
static constexpr auto Lib = "libstdc++";
#elif defined (_MSVC_STL_UPDATE)
static constexpr auto Lib = "ms-stl";
#else
static constexpr auto Lib = "libc++";
#endif
#if defined (_MSC_VER)
static constexpr auto Compiler = "MSVC";
static constexpr auto Major = _MSC_VER;
#else
static constexpr auto Compiler = "Clang";
static constexpr auto Major = __clang_major__;
#endif
auto g() -> std::generator<std::string> {
co_yield Compiler;
co_yield "import std;";
};
int main() {
std::expected<int, bool> exp = 42;
std::vector<std::string> vs;
for (auto && s : g()) {
vs.push_back(std::move(s));
}
std::println("{} {} & {} welcome '{}' !", vs[0], Major, Lib, vs[1]);
return vs.empty() + *exp;
}