]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
future (_Result_alloc): Derive from _Alloc, exploit the Empty Base Optimization.
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 8 Oct 2010 20:30:44 +0000 (20:30 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 8 Oct 2010 20:30:44 +0000 (20:30 +0000)
2010-10-08  Paolo Carlini  <paolo.carlini@oracle.com>

* include/std/future (_Result_alloc): Derive from _Alloc,
exploit the Empty Base Optimization.

From-SVN: r165194

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/future

index 172eb5b17366af421da2c9e5f9653dafa0ddad4b..b4ca4f215ce236bbc21b0b0ff9254e108b8290b4 100644 (file)
@@ -1,3 +1,8 @@
+2010-10-08  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * include/std/future (_Result_alloc): Derive from _Alloc,
+       exploit the Empty Base Optimization.
+
 2010-10-08  Jonathan Wakely  <jwakely.gcc@gmail.com>
 
        PR libstdc++/45403
index ff566983ca28810810697a8d6f53a52435449370..2933c8be63f4db3e696aee96cb6f9f2a0f0d014f 100644 (file)
@@ -215,24 +215,22 @@ namespace std
 
     /// Result_alloc.
     template<typename _Res, typename _Alloc>
-      struct _Result_alloc : _Result<_Res>
+      struct _Result_alloc : _Result<_Res>, _Alloc
       {
         typedef typename _Alloc::template rebind<_Result_alloc>::other
           __allocator_type;
 
         explicit
-       _Result_alloc(const _Alloc& __a) : _Result<_Res>(), _M_alloc(__a)
+       _Result_alloc(const _Alloc& __a) : _Result<_Res>(), _Alloc(__a)
         { }
        
       private:
        void _M_destroy()
         {
-          __allocator_type __a(_M_alloc);
+          __allocator_type __a(*this);
           __a.destroy(this);
           __a.deallocate(this, 1);
         }
-
-        __allocator_type _M_alloc;
       };
 
     template<typename _Res, typename _Allocator>