-fdump-tree-gimple オプション (GCC 4.6.1) を使用して C++ をコンパイルすると、次の関数を含むコードが得られます。
std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = int, _Alloc = std::allocator<int>] (struct _Vector_base * const this)
{
int * D.8482;
long int D.8483;
int * D.8484;
long int D.8485;
long int D.8486;
long int D.8487;
long unsigned int D.8488;
int * D.8489;
struct _Vector_impl * D.8490;
{
try
{
D.8482 = this->_M_impl._M_end_of_storage;
D.8483 = (long int) D.8482;
D.8484 = this->_M_impl._M_start;
D.8485 = (long int) D.8484;
D.8486 = D.8483 - D.8485;
D.8487 = D.8486 /[ex] 4;
D.8488 = (long unsigned int) D.8487;
D.8489 = this->_M_impl._M_start;
std::_Vector_base<int, std::allocator<int> >::_M_deallocate(this, D.8489, D.8488);
}
finally
{
D.8490 = &this->_M_impl;
std::_Vector_base<int, std::allocator<int>::_Vector_impl::~_Vector_impl (D.8490);
}
}
<D.8393>:
}
を使用する簡単なプログラムを作成することで、このコードを取得できますstd::vector<int>
。いずれにせよ、私が理解していないコードの部分は の行D.8487 = D.8486 /[ex] 4;
です。のソース コードを調べたところ、/usr/include/c++/4.6.1/std_vector.h
そのデストラクタは を呼び出すワンライナーです_M_deallocate
。/[ex]
オペレーターの略を知っている人はいますか?これまでに気付いた唯一のことは、RHS オペランドが、ベクトルがパラメーター化する型のサイズであることです。