Is this of any interest for boost? Some library implementations (for instance STLport) return a value of container::max_size that doesn't depend on the corresponding allocator. For instance, for vector<T> STLport returns:
size_type(-1) / sizeof(T) As a result, if one uses his own allocator which has, say, a maximum size = 255, there's no hope that the user of vector can see the limit. Would something like this be ok? template <typename T> typename T::size_type max_size(const T& t) { // Note that there's no requirement for a container's // size_type to match its allocator size_type. // There is for basic_string. // typedef typename T::allocator_type allocator_type; const typename allocator_type::size_type max_alloc = t.get_allocator().max_size(); const typename T::size_type max_cont = t.max_size(); return max_alloc < max_cont? max_alloc : max_cont; } Genny. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost