をにiterator_traitsは私linked_listテンプレートのフラグメントです。構造体のSTDに「ポインタ」という名前の無いタイプ::ここ<...>
グラム++ 5.4:
list2.cxx:105:66: error: no type named ‘pointer’ in ‘struct std::iterator_traits<linked_list<int>::iterator_base<(linked_list<int, std::allocator<int> >::constantness)1u> >’
typename std::iterator_traits<iterator_base>::pointer operator ->() const { return &(to_obj_node(current_node_) -> object()) ; }
ICPC:
list.cxx(105): error: incomplete type is not allowed typename std::iterator_traits<iterator_base>::pointer operator ->() const { return &(to_obj_node(current_node_) -> object()) ; }
その行がなければ、すべてはうまくコンパイルします。
質問です:何が起こる、私は(そのような変更のコードはコンパイルのみで)上記のコードでusing difference_type = typename std::iterator_traits<iterator>::difference_type;
をコメントしていたときに。?
==============================================その上============================ res.on.functions/2.5
- In particular, the effects are undefined in the following cases:...
- if an incomplete type ([basic.types]) is used as a template argument when instantiating a template component, unless specifically allowed for that component.
や歴史discussion。 Pointer_nah
の宣言の時点で
[mcve] – Barry
を入力してください。ノード< T >とは何ですか? – wally
'#include'ですか? –