Code4Food
2020-5-4 08:10:12
I don't know if I can tell you want we use internally so I just talk about C++ programming in general and Google's open source projects. I think you will find use of std::shared_ptr in many modern C++ code bases.
In Google's Abseil strings library. There is a data structure called Cord. A cord can store text just like a string but internally it is constructed using smaller cords. This makes string part sharable and concatenation very cheap. To determine if a cord can be deleted, reference counting is used.
For thread safety, the reference counter is implemented using C++'s atomic type.
Code4Food
2020-5-4 08:14:27
I don't know Rust but I read the documentation on borrowing. It seems to be difficult, if not impossible, to do that in C++. Rust's borrow checking is done in compile-time. You can implemented a smart pointer class in C++ to imposed similar restriction of having only one mutable reference at a time in run-time. It does not seem to me that your can guarantee a C++ compiler to do enough constant propagation to check that in compile-time like Rust.
以矽谷為例子:高人工嘅公司(FAANG or comparable)而家fresh grad係12萬美金一年到,但通常有bonus同股票。total compensation可以係16/17萬或以上一年。無1/3稅都應該有你個range。不過矽谷物價貴,人工要高返先請到人。內陸小鎮做IT唔會有咁高,但生活平好多。