Skip to content

Commit dad429e

Browse files
committed
print c++ version
1 parent 0c77022 commit dad429e

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

src/main.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
11
#include <iostream>
2-
#include <vector>
2+
// #include <vector>
33
#include <ystdlib/testlib/hello.hpp>
44

55
[[nodiscard]] auto main() -> int {
6-
constexpr std::vector<int> cV;
6+
// constexpr std::vector<int> cV;
77
std::cout << ystdlib::testlib::hello() << '\n';
8+
constexpr auto c23{202'101L};
9+
constexpr auto c20{202'002L};
10+
constexpr auto c17{201'703L};
11+
constexpr auto c14{201'402L};
12+
constexpr auto c11{201'103L};
13+
constexpr auto c98{199'711L};
14+
if (__cplusplus == c23) {
15+
std::cout << "C++23";
16+
} else if (__cplusplus == c20) {
17+
std::cout << "C++20";
18+
} else if (__cplusplus == c17) {
19+
std::cout << "C++17";
20+
} else if (__cplusplus == c14) {
21+
std::cout << "C++14";
22+
} else if (__cplusplus == c11) {
23+
std::cout << "C++11";
24+
} else if (__cplusplus == c98) {
25+
std::cout << "C++98";
26+
} else {
27+
std::cout << "pre-standard C++." << __cplusplus;
28+
}
29+
std::cout << "\n";
830
return 0;
931
}

taskfiles/build.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ tasks:
1414
--build "{{.G_BUILD_DIR}}"
1515
--parallel {{numCPU}}
1616
--target {{range .TARGETS}}{{.}} {{end}}
17+
- ./build/dummy
1718

1819
clean:
1920
desc: "Removes all built artifacts."
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
# Exit on any error
4+
set -e
5+
6+
# Error on undefined variable
7+
set -u
8+
9+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
10+
11+
echo "Nothing to be installed for macOS."

0 commit comments

Comments
 (0)