optional typename without name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

Codeguru about allocators: They say the std::allocator that
compiler vendors normally ship looks something like:

template<typename T>
class Allocator {
  typedef T value_type;
  typedef value_type* pointer;
  typedef const value_type* const_pointer;
  typedef value_type& reference;
  typedef const value_type& const_reference;
  typedef std::size_t size_type;
  typedef std::ptrdiff_t difference_type;
//...
public :
  inline pointer allocate(
    size_type cnt,
    typename std::allocator<void>::const_pointer = 0) {
      return reinterpret_cast<pointer>(::operator new(cnt * sizeof (T)));
    }
//...
}

Would it be possible for someone to explain why the optional argument
typename std::allocator<void>::const_pointer = 0 is there?

It's a typename that can be suppressed. Why to write it in the first place then? Is this written to disambiguate something?


Frank

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux