Function returning pointer to itself?

前端 未结 4 1767
闹比i
闹比i 2020-12-28 14:35

Is it possible in C++ to write a function that returns a pointer to itself?

If no, suggest some other solution to make the following syntax work:

som         


        
4条回答
  •  醉梦人生
    2020-12-28 15:15

    No, you can't, because the return type has to include the return type of the function, which is recursive. You can of course return function objects or something like that which can do this.

提交回复
热议问题