4 ms·
Rust is also getting configurable allocators soon. Most standard collections will take an additional, optional allocator. There are also a few people who want
by nynx 6y ago
Rust is also getting configurable allocators soon. Most standard collections will take an additional, optional allocator.
There are also a few people who want to rethink the design of allocators to allow for inline storage. It definitely sounds interesting, but may end up being too complicated.
- mmastrac 6y agoDo you have a link to the RFC for this? This sounds awesome. EDIT: thanks to the links below I found this [1] and this [2] [1] https://github.com/rust-lang/rust/issues/32838 https://github.com/rust-lang/rust/issues/32838 [2] https://github.com/rust-lang/rfcs/pull/1398 https://github.com/rust-lang/rfcs/pull/1398
- swsieber 6y agoWhile I don't have an RFC your you (I'm not the same person), here's an interesting thread on maybe tweaking the interface: https://internals.rust-lang.org/t/is-custom-allocators-the-right-abstraction/13460 https://internals.rust-lang.org/t/is-custom-allocators-the-r...
- troutwine 6y agoAnd here's the working group's repo: https://github.com/rust-lang/wg-allocators https://github.com/rust-lang/wg-allocators
- nynx 6y agoI'm not sure there's an up-to-date RFC, but here's what it looks like: https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.new_in https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#...
- secondcoming 6y agoWill they avoid the Transparent Comparator fudge that C++ has because the allocator is part of the type? https://stackoverflow.com/questions/20317413/what-are-transparent-comparators https://stackoverflow.com/questions/20317413/what-are-transp...
- nynx 6y agoCould you elaborate on what this is, exactly?
- secondcoming 6y agoIn short, it allows a std::map<K, V> to be queried with a type that isn't K. For example, std::map<std::string, int> m; std::string_view sv = "mykey"; auto&& iter = m.find(sv);
- nynx 6y agoOh, rust already has that.