yonil - 2006-11-24

This is a totally minor nitpicking, feel free to ignore it :)

While going through some of the code of STLport, I came across the following function in _alloc.h.

template <class _Tp, class _Alloc>
inline _STLP_TYPENAME_ON_RETURN_TYPE _Alloc_traits<_Tp, _Alloc>::allocator_type  _STLP_CALL
__stl_alloc_create(const _Alloc& __a, const _Tp*) {
  typedef typename _Alloc::_STLP_TEMPLATE rebind<_Tp>::other _Rebound_type;
  return _Rebound_type(__a);
}

And the definition of _Alloc_traits<_Tp, _Alloc>::allocator_type is:
template <class _Tp, class _Allocator>
struct _Alloc_traits {
...
  typedef typename _Allocator::_STLP_TEMPLATE rebind<_Tp> _Rebind_type;
  typedef typename _Rebind_type::other  allocator_type;

If I understood it correctly, the type _Rebound_type declared in the function is identical to its return type.
What I didn't get about this, is why _Rebound_type is defined this way. I think changing the definition to
  typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type _Rebound_type;

makes the code easier to understand. It readily shows there is no magic type casting going on.