From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-02-16 18:58:05


Jason Hise wrote:
> Jonathan Turkanis wrote:
>
>> I suggested you follow policy_ptr and use mpl metafunction classes
>> as policy template parameters. See, for instance, the array storage
>> policy: http://tinyurl.com/6tbhu.
>>
>> It looks like this:
>>
>> template <typename T>
>> class array_storage_
>> { ... };
>>
>> struct array_storage
>> {
>> typedef storage_policy_tag policy_category;
>>
>> template <typename T>
>> struct apply
>> {
>> typedef array_storage_<T> type;
>> };
>> };
>>
>> Jonathan
>>
> is this essentially the equivalent of the standard allocator's rebind?

The difference is that an allocator is designed *both* to be used by itself and
to generate other allocator types. A metafunction class is generally just a type
generator. (In the above example there is also some auxilliary machinery to
support identifying template arguments by category rather than position.)

Jonathan