Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct MutRefVec<T> {
- vec:Vec<*mut T>,
- }
- impl<T> MutRefVec<T> {
- pub fn new() -> Self {
- MutRefVec { vec:Vec::new() }
- }
- pub fn push(&mut self, x:&mut T) {
- self.vec.push(x as *mut T)
- }
- pub fn get(&mut self, i:usize) -> &mut T {
- unsafe { &mut *self.vec[i] }
- }
- }
- fn main() {}
Add Comment
Please, Sign In to add comment