2
TBB 사용자 지정 메모리 할당자를 사용하고 있습니다.동적으로 할당 된 stl 컨테이너에 할당자를 설정하는 방법은 무엇입니까?
tbb::memory_pool<std::allocator<char>> shortTermPool;
typedef tbb::memory_pool_allocator<Result*> custom_allocator;
std::vector<Result*,custom_allocator>* results =(std::vector<Result*,custom_allocator>*)shortTermPool.malloc(sizeof(std::vector<Result*,custom_allocator>));
할당 자 설정은 생성자에 있습니다. Malloc은 생성자를 호출하지 않습니다. 기본 사용법은 다음과 같이 될 것이다 :
tbb::memory_pool<std::allocator<char>> shortTermPool;
typedef tbb::memory_pool_allocator<Result*> custom_allocator;
std::vector<Result*,custom_allocator> results (custom_allocator(shortTermPool));
STL과 용기의 malloc을 할 수있는 방법이 있나요하고 이후 사용자 정의 할당을 할당?
이러한 방식으로 C++ 11 초기화되지 않은 저장소에 사용자 지정 할당자를 사용할 수 있습니까? – fish2000