▲ | tialaramex 5 days ago | |||||||
As STL (nominative determinism at work) points out in the r/cpp thread about this, even when that git repo didn't exist you could have gone to see how this template works because C++ has to monomorphize generics somehow and that means when you write shared_ptr<goose> your C++ compiler needs to compile the source code for shared_ptr with the T replaced by goose. But you're correct, while I can read https://doc.rust-lang.org/src/alloc/sync.rs.html (where Rust's Arc is defined) ... ... good luck to me in https://github.com/microsoft/STL/blob/main/stl/inc/memory There are tricks to cope with C++ macros not being hygienic, layered on top of tricks to cope with the fact C++ doesn't have ZSTs, tricks to reduce redundancy in writing all this out for related types, and hacks to improve compiler diagnostics when you do something especially stupid. Do its maintainers learn to read like this? I guess so, as it's Open Source. | ||||||||
▲ | chuckadams 5 days ago | parent [-] | |||||||
It also helps that the Rust version is lavishly documented with examples, and the C++ version has barely any comments at all. | ||||||||
|