Guest User

openfst: Use allocator_traits::allocate in memory.h

a guest
Aug 26th, 2022
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 0.69 KB | Source Code | 0 0
  1. --- src/include/fst/memory.h
  2. +++ src/include/fst/memory.h
  3. @@ -241,7 +241,8 @@ class BlockAllocator {
  4.      if (n * kAllocFit <= kAllocSize) {
  5.        return static_cast<T *>(Arena()->Allocate(n));
  6.      } else {
  7. -      return Allocator().allocate(n, hint);
  8. +      auto alloc = Allocator();
  9. +      return std::allocator_traits<Allocator>::allocate(alloc, n, hint);
  10.      }
  11.    }
  12.  
  13. @@ -307,7 +308,8 @@ class PoolAllocator {
  14.      } else if (n <= 64) {
  15.        return static_cast<T *>(Pool<64>()->Allocate());
  16.      } else {
  17. -      return Allocator().allocate(n, hint);
  18. +      auto alloc = Allocator();
  19. +      return std::allocator_traits<Allocator>::allocate(alloc, n, hint);
  20.      }
  21.    }
  22.  
  23.  
Advertisement
Add Comment
Please, Sign In to add comment