-
-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathmain.cpp
54 lines (44 loc) · 1.26 KB
/
main.cpp
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// test external pac
#include <docopt/docopt.h>
#include <Eigen/Dense>
#include <fmt/core.h>
#include <fmt/ostream.h>
#include <fmt/ranges.h>
// test std libraries
#include <iostream>
#include <map>
#include <string>
#include <string_view>
// test c libraries
#include <cassert>
#include <cctype>
#include <cstddef>
#include <cstdint>
#include <cstring>
static std::string const usage{
R"(main.
Usage:
main
main (-h | --help)
main --version
Options:
-h --help Show this screen.
--version Show version.
)"};
int main(int argc, char const* argv[]) {
std::map<std::string, docopt::value> args{docopt::docopt(usage, {argv + 1, argv + argc}, /*help=*/true, "main 1.0")};
for (auto const& arg : args) {
fmt::println("{}: {}", arg.first, fmt::streamed(arg.second));
}
Eigen::VectorXd eigen_vec = Eigen::Vector3d(1, 2, 3);
fmt::println("[{}]", fmt::join(eigen_vec, ", "));
#if !defined(__MINGW32__) && !defined(__MSYS__)// TODO fails
Eigen::VectorXd eigen_vec2 = Eigen::VectorXd::LinSpaced(10, 0, 1);
fmt::println("[{}]", fmt::join(eigen_vec2, ", "));
#endif
// trigger address sanitizer
// int *p = nullptr;
// *p = 1;
// trigger compiler warnings, clang-tidy, and cppcheck
int a;
}