次の単純化がありますが、これは機能します。
// works:
template<typename NodeStructure>
struct ListNode {
NodeStructure *prev, *next;
};
template<typename NodeStructure, ListNode<NodeStructure> NodeStructure::*node>
struct ListBase {
NodeStructure *head, *tail;
};
struct N {
ListNode<N> node;
};
struct B {
ListBase<N, &N::node> base;
};
しかし、これは機能しません
template<typename NodeStructure>
struct List {
struct Node {
NodeStructure *prev, *next;
};
template<Node NodeStructure::*node>
struct Base {
NodeStructure *head, *tail;
};
};
struct N {
List<N>::Node node;
};
struct B {
List<N>::Base<&N::node> base; // ERROR: Invalid template argument, ¿why?
};
実際のコードでは、List テンプレートはより多くのテンプレート パラメータを受け取り、追加のクラス Iterator を定義します。
いいえ、IDEの問題です!!
ネストされたテンプレート引数をスキャンすると、Eclipse CDT / コード分析で誤検知が発生します。
回答ありがとうございます。