Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
233 views
in Technique[技术] by (71.8m points)

C++ tbb flow graph, multifunction_node giving incomplete type error

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...