|
|
|
|
|
by Const-me
3351 days ago
|
|
I’m sure Rust smart pointers are implemented using traditional C pointers. Regardless of how you call them, you still can’t use them to compose data structures into higher-level structures in Rust. In C++ with raw pointers, I can combine a hashmap with an existing collection of values to speed up lookups, without duplicating values. I can combine hash map with linked list to create an efficient LRU cache, with a few lines of my own code. C++ can do that because collections, std::unordered_map, std::list and the rest of them, expose raw pointers at their API boundaries. It’s possible to store these pointers in other collections, encapsulating one or more simple data structures into a higher-level specialized data structure, with the performance characteristics suitable for the job. |
|