【g++bug】 vector.erase (const_iterator)調用報錯

報錯如下:no matching function for call to ‘std::vector<TYPE>::erase(__gnu_cxx::__normal_iterator<const int*, std::vector<TYPE> >&)’

               v.erase(e);

原因:g++未實現這個接口,但c++11標準定義了這個接口,算編譯器bug。g++4.9.0修正。

詳情:

         1、接口定義如下,參見http://www.cplusplus.com/reference/vector/vector/erase/

iterator erase (const_iterator position);
iterator erase (const_iterator first, const_iterator last);

2、bug反饋如下,參見https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577

Bug 54577 deque<T>::erase() still takes iterator instead of const_iterator
Status: RESOLVED FIXED
 
Alias: None
 
Product: gcc
Component: libstdc++ (show other bugs)
Version: 4.6.1
 
: P3 normal
Target Milestone: 4.9.0
Assignee: Paolo Carlini
 
URL:
Keywords:  
 
: 55675 57158 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-09-14 01:06 UTC by thunderliu
Modified: 2013-05-10 15:19 UTC (History)
4 users (show)
 
See Also:  
Host:  
Target:  
Build:  
Known to work:  
Known to fail:  
Last reconfirmed: 2013-05-03 00:00:00

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章