c++ boost::any to define my own print ,

后端 未结 4 1022
野的像风
野的像风 2021-02-04 22:00

Am struggling a lot to find how to do to use boost::any to create a print function that can print any type using template first.

template 

        
4条回答
  •  -上瘾入骨i
    2021-02-04 22:34

    Check out this thread on the Boost mailing list: http://lists.boost.org/Archives/boost/2005/01/79232.php

    It has a few ideas, some of which seem sort of OK and some of which don't (to me). Overall, though, this seems like a difficult task to accomplish in a general way, since (as mentioned in that thread), some types will never be ostream'able, yet could be contained in a boost::any object.

提交回复
热议问题