3 ms·
STL lets you supply a custom allocator for all STL types. Afaik, Rust doesn't and this is probably the price you have to pay for that feature.
by bjourne 4y ago
STL lets you supply a custom allocator for all STL types. Afaik, Rust doesn't and this is probably the price you have to pay for that feature.
- steveklabnik 4y agoBox is parameterized by an allocator: https://doc.rust-lang.org/stable/std/boxed/struct.Box.html https://doc.rust-lang.org/stable/std/boxed/struct.Box.html Rust doesn’t let you utilize this fact on stable yet, which is what you’re thinking of, but the implementation in this case already exists.
- vasama 4y agoIf by "STL" you mean the standard library, it's not true that _all_ containers accept allocators. At least valarray and filesystem::path do not accept allocators.