我知道Visual Studio2010的标准库已经被重写以支持右值引用,这大大提高了它的性能。
gcc 4.4 (及以上版本)的标准库实现是否支持右值引用?
发布于 2010-04-21 15:20:25
我在gcc 4.4的STL中发现了这一点:
#ifdef __GXX_EXPERIMENTAL_CXX0X__
_Vector_base(_Vector_base&& __x)
: _M_impl(__x._M_get_Tp_allocator())
{
this->_M_impl._M_start = __x._M_impl._M_start;
this->_M_impl._M_finish = __x._M_impl._M_finish;
this->_M_impl._M_end_of_storage = __x._M_impl._M_end_of_storage;
__x._M_impl._M_start = 0;
__x._M_impl._M_finish = 0;
__x._M_impl._M_end_of_storage = 0;
}
#endif
发布于 2010-04-21 14:39:08
GCC supports rvalue references。不幸的是,the libstc++ page没有说明库实现是否利用了这一点。
https://stackoverflow.com/questions/2680311
复制相似问题