uniqueobject.hpp
来自「Boost provides free peer-reviewed portab」· HPP 代码 · 共 42 行
HPP
42 行
#ifndef BOOST_STATECHART_EXAMPLE_UNIQUE_OBJECT_HPP_INCLUDED#define BOOST_STATECHART_EXAMPLE_UNIQUE_OBJECT_HPP_INCLUDED//////////////////////////////////////////////////////////////////////////////// Copyright 2002-2006 Andreas Huber Doenni// Distributed under the Boost Software License, Version 1.0. (See accompany-// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)//////////////////////////////////////////////////////////////////////////////#include "UniqueObjectAllocator.hpp"#include <cstddef> // size_t//////////////////////////////////////////////////////////////////////////////template< class Derived >class UniqueObject{ public: ////////////////////////////////////////////////////////////////////////// void * operator new( std::size_t size ) { return UniqueObjectAllocator< Derived >::allocate( size ); } void operator delete( void * p, std::size_t size ) { UniqueObjectAllocator< Derived >::deallocate( p, size ); } protected: ////////////////////////////////////////////////////////////////////////// UniqueObject() {} ~UniqueObject() {}};#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?