Topic: lib.allocator.members


Author: ncm@netcom.com (Nathan Myers)
Date: 1995/05/11
Raw View
In article <3opbjp$ppq@news.csie.nctu.edu.tw>,
Hung-Chai Info Company <whtang@monica> wrote:
>what's the purpose of the argument "hint" in
> template<class T, class U>
>   typename types<T>::pointer
>     allocate(size_type n, typename types<U>::const_pointer hint);
>
>reference: [lib.allocator.members], 20 12, 20.4.1

This is a good question.

The "hint" is intended to allow implementors a chance to optimize
for locality of reference; users probably should usually pass "this"
to it.  (The implementor who suggested this was at an object
database house, and was concerned about performance in their
ODB allocator.)  Probably many implementations will ignore the
argument in their default allocator, but you never know what
allocator a user will specify.

Probably the standard should have a recommendation for what to
pass in that argument, even if it's not normative.

Nathan Myers
myersn@roguewave.com





Author: whtang@monica (Hung-Chai Info Company)
Date: 1995/05/10
Raw View
what's the purpose of the argument "hint" in
 template<class T, class U>
   typename types<T>::pointer
     allocate(size_type n, typename types<U>::const_pointer hint);
??

reference: [lib.allocator.members], 20 12, 20.4.1

whtang@dblab.cs.nchu.edu.tw