This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/15775] New: Allocator::pointer consistently ignored


Many (if not all) STL containers use typedefs like:

      typedef value_type*                        pointer;
      typedef const value_type*                  const_pointer;
      typedef value_type&                        reference;
      typedef const value_type&                  const_reference;

However, according to the standard it should be Allocator::pointer etc.
For example, 23.2.1 Template class deque [lib.deque] says

namespace std {
  template <class T, class Allocator = allocator<T> >
  class deque {
  public:
    // types:
    typedef typename Allocator::reference         reference;
    typedef typename Allocator::const_reference   const_reference;
                                                                   // See 23.1
    typedef implementation defined                iterator;
                                                  const_iterator; // See 23.1
    typedef implementation defined
                                                                   // See 23.1
    typedef implementation defined                size_type;
                                                  difference_type; // See 23.1
    typedef implementation defined
    typedef T                                     value_type;
    typedef Allocator                             allocator_type;
    typedef typename Allocator::pointer           pointer;
    typedef typename Allocator::const_pointer     const_pointer;
    typedef std::reverse_iterator<iterator>       reverse_iterator;
    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;


and since Allocator is a user specified class, it cannot be correct
to replace these 'typename Allocator::pointer' with 'value_type*'.

-- 
           Summary: Allocator::pointer consistently ignored
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: carlo at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15775


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]