Patchwork [v3] add difference_type to __gnu_cxx::__alloc_traits

login
register
mail settings
Submitter Jonathan Wakely
Date April 22, 2012, 2:39 p.m.
Message ID <CAH6eHdRDbV-wTxuP5bh75gEvA6ODDXML14yROm7ZyvgtMitaTw@mail.gmail.com>
Download mbox | patch
Permalink /patch/154283/
State New
Headers show

Comments

Jonathan Wakely - April 22, 2012, 2:39 p.m.
The allocator_traits wrapper is missing difference_type, noticed while
making vstring allocator-aware.

       * include/ext/alloc_traits.h (__alloc_traits::difference_type):
       Define.

Tested x86_64-linux, committed to trunk.
commit 7a3e74660df7df20bebb7676cd9142841637ba40
Author: Jonathan Wakely <jwakely.gcc@gmail.com>
Date:   Wed Mar 21 09:40:45 2012 +0000

    	* include/ext/alloc_traits.h (__alloc_traits::difference_type):
    	Define.

Patch

diff --git a/libstdc++-v3/include/ext/alloc_traits.h b/libstdc++-v3/include/ext/alloc_traits.h
index 4862636..b3e3af6 100644
--- a/libstdc++-v3/include/ext/alloc_traits.h
+++ b/libstdc++-v3/include/ext/alloc_traits.h
@@ -99,6 +99,7 @@  template<typename _Alloc>
     typedef typename _Base_type::pointer            pointer;
     typedef typename _Base_type::const_pointer      const_pointer;
     typedef typename _Base_type::size_type          size_type;
+    typedef typename _Base_type::difference_type    difference_type;
     // C++0x allocators do not define reference or const_reference
     typedef value_type&                             reference;
     typedef const value_type&                       const_reference;
@@ -170,6 +171,7 @@  template<typename _Alloc>
     typedef typename _Alloc::reference              reference;
     typedef typename _Alloc::const_reference        const_reference;
     typedef typename _Alloc::size_type              size_type;
+    typedef typename _Alloc::difference_type        difference_type;
 
     static pointer
     allocate(_Alloc& __a, size_type __n)