当前位置: 首页>>代码示例>>C++>>正文


C++ block::reset方法代码示例

本文整理汇总了C++中block::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ block::reset方法的具体用法?C++ block::reset怎么用?C++ block::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在block的用法示例。


在下文中一共展示了block::reset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: deallocate

 /**
  * Frees the given block and resets it.
  * \param b Block to be freed.
  */
 void deallocate(block &b)
 {
   if (b) {
     ::free(b.ptr);
     b.reset();
   }
 }
开发者ID:respu,项目名称:AllocatorBuilder,代码行数:11,代码来源:mallocator.hpp

示例2: deallocate

      /**
       * Frees the given block back to the system. The block gets nulled.
       * \param b The block, describing what memory shall be freed.
       */
      void deallocate(block &b) noexcept
      {
        if (b) {
#ifdef _MSC_VER
          _aligned_free(b.ptr);
#else
          ::free(b.ptr);
#endif
          b.reset();
        }
      }
开发者ID:FelixPetriconi,项目名称:AllocatorBuilder,代码行数:15,代码来源:aligned_mallocator.hpp

示例3: deallocate

 /**
  * The given block gets deallocated. If Prefix or Sufix are defined then
  * their d'tor(s) are called.
  * \param b The Block that should be freed. 
  */
 void deallocate(block &b) noexcept
 {
   if (!b) {
     return;
   }
   if (prefix_size > 0) {
     outerToPrefix(b)->~Prefix();
   }
   if (sufix_size > 0) {
     outerToSufix(b)->~Sufix();
   }
   auto innerBlock(toInnerBlock(b));
   _allocator.deallocate(innerBlock);
   b.reset();
 }
开发者ID:me-minus,项目名称:AllocatorBuilder,代码行数:20,代码来源:affix_allocator.hpp

示例4: deallocate

 /**
  * The given block gets deallocated. If Prefix or Sufix are defined then
  * their d'tor(s) are called.
  * \param b The Block that should be freed.
  */
 void deallocate(block &b) noexcept
 {
   if (!b) {
     return;
   }
   if (prefix_size > 0) {
     outer_to_prefix(b)->~Prefix();
   }
   if (sufix_size > 0) {
     outer_to_sufix(b)->~Sufix();
   }
   auto innerBlock(to_inner_block(b));
   allocator_.deallocate(innerBlock);
   b.reset();
 }
开发者ID:FelixPetriconi,项目名称:AllocatorBuilder,代码行数:20,代码来源:affix_allocator.hpp

示例5: deallocate

    void deallocate(block &b) noexcept
    {
      if (!b) {
        return;
      }
      if (!owns(b)) {
        assert(false);
        return;
      }

      // If it was the most recent allocated MemoryBlock, then we can re-use the
      // memory. Otherwise this freed MemoryBlock is not available for further
      // allocations. Since all happens on the stack this is not a leak!
      if (isLastUsedBlock(b)) {
        _p = static_cast<char *>(b.ptr);
      }
      b.reset();
    }
开发者ID:me-minus,项目名称:AllocatorBuilder,代码行数:18,代码来源:stack_allocator.hpp


注:本文中的block::reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。