mirror of git://gcc.gnu.org/git/gcc.git
future (_Result_alloc): Derive from _Alloc, exploit the Empty Base Optimization.
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
This commit is contained in:
parent
bd39cb5225
commit
0fd76d8e4c
|
@ -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>
|
2010-10-08 Jonathan Wakely <jwakely.gcc@gmail.com>
|
||||||
|
|
||||||
PR libstdc++/45403
|
PR libstdc++/45403
|
||||||
|
|
|
@ -215,24 +215,22 @@ namespace std
|
||||||
|
|
||||||
/// Result_alloc.
|
/// Result_alloc.
|
||||||
template<typename _Res, typename _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
|
typedef typename _Alloc::template rebind<_Result_alloc>::other
|
||||||
__allocator_type;
|
__allocator_type;
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
_Result_alloc(const _Alloc& __a) : _Result<_Res>(), _M_alloc(__a)
|
_Result_alloc(const _Alloc& __a) : _Result<_Res>(), _Alloc(__a)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _M_destroy()
|
void _M_destroy()
|
||||||
{
|
{
|
||||||
__allocator_type __a(_M_alloc);
|
__allocator_type __a(*this);
|
||||||
__a.destroy(this);
|
__a.destroy(this);
|
||||||
__a.deallocate(this, 1);
|
__a.deallocate(this, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
__allocator_type _M_alloc;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _Res, typename _Allocator>
|
template<typename _Res, typename _Allocator>
|
||||||
|
|
Loading…
Reference in New Issue