Far as I understand, incomplete type error happens when there's forward declaration without full specification of type, then instantiate that type since the compiler can't tell the size of such type.
In my case I don't understand how this code produces such a problem. For simplicity I've removed unrelated parts.
class FilterOnNode {
struct PartialResult { int n1,n2; long e; };
typedef PartialResult* InputResult;
typedef tbb::flow::multifunction_node<InputResult, InputResult> FilterNodeType;
void BuildGraph(tbb::flow::graph &g, tbb::flow::graph_node &src) {
auto sampleNode = FilterNodeType(
g,
tbb::flow::concurrency::unlimited,
[&](const InputResult &input, typename FilterNodeType::output_ports_type &op) { //error points to here
//some logic here... might not send message.
std::get<0>(op).try_put(input);
});
tbb::flow::make_edge(src, sampleNode);
//create couple other nodes like previous then connect edges
tbb::flow::make_edge(tbb::flow::output_port<0>(sampleNode), otherNode);
}
compiler is giving error of incomplete type at the lambda expression. Exact error says:
/usr/local/include/tbb/flow_graph.h:1568:7: error: incomplete type ‘std::tuple_size<FilterOnNode::PartialResult*>’ used in nested name specifier class multifunction_node
Isn't the type PartialResult fully specified already? Tried taking it out of the class but still same problem.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…