[LLVMdev] Forward: Discussion about custom memory allocators for STL

Chris Lattner sabre at nondot.org
Fri May 23 22:17:02 PDT 2008


On May 18, 2008, at 1:36 AM, Roman Levenstein wrote:
>> Ideally, I would be able to do something like:
>>
>>   MyRegion R;
>>   std:set(R);
>>   std::map(R);
>
> This is exactly the way, how I intended to use custom STL allocators.
> Doing it selectively on the container intance basis is very important.

Cool.  The other thing that would be nice is the ability to be able to  
put multiple containers into one region.

>>> - possibility of using 3rd party libs like Boost (or their parts) in
>>> LLVM
>>
>> We have already imported pieces of boost.
>
> BTW, which ones?

include/llvm/ADT/OwningPtr.h was heavily influenced from some boost  
smart pointer.

>> but they have to be converted to the  LLVM style and way of doing  
>> things.
>> Also, things with huge chains of  dependencies sometimes have to be  
>> simplified.
>
> One comment here:
> While I agree with this approach for most libraries, I think that  
> boost is (almost) becoming
> a second-important libray for C++, almost as important as the STL.  
> Therefore,
> modifying/re-formating/converting it it is not such a great idea,  
> eventually,
> since everyone using it assumes that its implementation and  
> semantics is exactly the
> same on each platform.

I understand with your sentiment, but pulling in hundreds of header  
files just isn't worth it if the functionality is conceptually small  
and simple.  If it were something complicated and necessary (e.g. we  
decided to use boost regex or something) then we certainly wouldn't  
want to make changes to it.  For something trivial like a smart  
pointer, there is little harm.

-Chris



More information about the llvm-dev mailing list