When should I use std::any

后端 未结 4 1818
悲哀的现实
悲哀的现实 2020-12-16 12:39

Since C++17 std::any is introduced. One can now write code like this

#include 
#include 
#include 

int         


        
4条回答
  •  旧时难觅i
    2020-12-16 13:01

    It's used in Wt, to provide a non-template interface for tabular data.

    There are conversions to string for builtin and Wt types, and you can register additional conversions by specialising Wt::any_traits. This allows anything to be displayed as an entry in a table, the view classes don't have to know anything about the types they are displaying.

提交回复
热议问题