How do I find out if a tuple contains a type?

后端 未结 7 1789
时光说笑
时光说笑 2020-11-30 08:50

Suppose I want to create a compile-time heterogenous container of unique types from some sequence of non-unique types. In order to do this I need to iterate over th

7条回答
  •  执念已碎
    2020-11-30 09:06

    Since you asked for it, here is a boost::mpl version:

    #include 
    #include 
    #include 
    #include 
    
    using namespace boost;
    
    template
    struct unique_concat : 
      mpl::unique>::type, 
                  is_same> {};
    
    template
    struct print;
    
    int main()
    {
      typedef mpl::vector input;
      print::type> asdf;
    
      return 0;
    }
    

提交回复
热议问题