std::string_view print_type(const variant_type& jtt) {
using namespace std::literals;
return inpect (jtt) {
<double> __ => "Number"sv;
<bool> __ => "Bool"sv;
...
};
}
In any case, `std::variant` should have been a language feature all along, instead of a library one; cf. Rust: enum Value {
Number(f64),
Bool(bool),
...
}
fn print_type(v: &Value) -> &str {
match v {
Value::Number(_) => "Number",
Value::Bool(_) => "Bool",
...
}
} https://github.com/tsgates/rust.ko/commit/58f0fb8fdf4063f5b24a09cbfeec81bf28a9d81b
There were others: John Baublitz had a external kernel module going on, Samantha Miller also worked on enabling a FUSE-like API to write filesystems in Rust, etc. And, of course, Alex Gaynor & Geoffrey Thomas had the most mature Rust abstractions for external kernel modules.
But that would not make me pick C++ over Rust. Other requirements may.