Ignore:
Timestamp:
Dec 15, 2017, 12:44:01 PM (22 months ago)
Author:
nmedfort
Message:

Initial check-in of LookAhead? support; modified LineBreakKernel? to compute CR+LF using LookAhead?(1) + misc. fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/util/slab_allocator.h

    r5748 r5782  
    2424
    2525    template<typename Type = T>
    26     inline Type * allocate(size_type n, const_pointer = nullptr) noexcept {
     26    inline Type * allocate(const size_type n, const_pointer = nullptr) noexcept {
    2727        static_assert(sizeof(Type) > 0, "Cannot allocate a zero-length type.");
    28         assert ("Cannot allocate 0 items." && n > 0);
     28        assert ("A memory leak will occur whenever the SlabAllocator allocates 0 items" && n > 0);
    2929        auto ptr = static_cast<Type *>(mAllocator.Allocate(n * sizeof(Type), sizeof(void*)));
    30         assert ("Allocating returned a null pointer. Function was likely called before Allocator creation!" && ptr);
     30        assert ("allocator returned a null pointer. Function was likely called before Allocator creation!" && ptr);
    3131        return ptr;
    3232    }
     
    4242
    4343    template<typename Type = T>
    44     inline bool operator==(SlabAllocator<Type> const & other) {
     44    inline bool operator==(SlabAllocator<Type> const & other) const noexcept {
    4545        return this == &other;
    4646    }
    4747
    4848    template<typename Type = T>
    49     inline bool operator!=(SlabAllocator<Type> const & other) {
     49    inline bool operator!=(SlabAllocator<Type> const & other) const noexcept {
    5050        return this != &other;
    5151    }
    5252
    53     inline size_type getTotalMemory() const {
     53    inline size_type getTotalMemory() const noexcept {
    5454        return mAllocator.getTotalMemory();
    5555    }
     
    6161    inline SlabAllocator() noexcept {}
    6262    inline SlabAllocator(const SlabAllocator &) noexcept = delete;
    63     template <class U> inline SlabAllocator (const SlabAllocator<U> &) noexcept { assert (false); }
     63    template <class U> inline SlabAllocator (const SlabAllocator<U> &) noexcept { }
    6464private:
    6565    LLVMAllocator mAllocator;
     
    9898    }
    9999
    100     inline size_type max_size() const {
     100    inline size_type max_size() const noexcept {
    101101        return std::numeric_limits<size_type>::max();
    102102    }
    103103
    104104    template<typename Type = T>
    105     inline bool operator==(ProxyAllocator<Type> const & other) {
     105    inline bool operator==(ProxyAllocator<Type> const & other) const noexcept {
    106106        return mAllocator == other.mAllocator;
    107107    }
    108108
    109109    template<typename Type = T>
    110     inline bool operator!=(ProxyAllocator<Type> const & other) {
     110    inline bool operator!=(ProxyAllocator<Type> const & other) const noexcept {
    111111        return mAllocator != other.mAllocator;
    112112    }
    113113
    114     inline size_type getTotalMemory() const {
     114    inline size_type getTotalMemory() const noexcept {
    115115        return mAllocator->getTotalMemory();
    116116    }
Note: See TracChangeset for help on using the changeset viewer.