There may also be situations when you want to use a container that has more template parameters than just ValueType. For instance, you may want to supply the allocator type. One way to do this is to hard-code in the extra parameters within the specialization of container_gen. However, if you want more flexibility then you can add a template parameter to the selector class. In the code below we show how to create a selector that lets you specify the allocator to be used with the std::list.
template <class Allocator> struct list_with_allocatorS { }; namespace boost { template <class Alloc, class ValueType> struct container_gen<list_with_allocatorS<Alloc>, ValueType> { typedef typename Alloc::template rebind<ValueType>::other Allocator; typedef std::list<ValueType, Allocator> type; }; }
There may also be situations when you want to use a container that has more template parameters than just ValueType. For instance, you may want to supply the allocator type. In the code below we show how to create a selector that lets you specify the allocator to be used with the std::list.
template <class Alloc> struct list_with_allocatorS{template <class ValueType>struct apply{ typedef typename Alloc::template rebind<ValueType>::other Allocator; typedef std::list<ValueType, Allocator> type; };};
===================================================