2005-12-22
boost::singleton_pool 사용법
struct CharArray512 {};
int _tmain(int argc, _TCHAR* argv[])
{
typedef boost::singleton_pool<CharArray512,512> TestPool;
void * pBuf = TestPool::malloc();
assert( pBuf > 0 );
TestPool::free(pBuf);
return 0;
}
singleton_pool 의 첫번째 템플릿 파라미터인 태그는, 동일한 크기의 버퍼에 대해서 각각 풀을 사용해야 할 때 구분자로 사용된다.