C++11 emplace_back on vector?

前端 未结 8 656
借酒劲吻你
借酒劲吻你 2020-12-02 14:58

Consider the following program:

#include 
#include 

using namespace std;

struct T
{
    int a;
    double b;
    string c;
};

         


        
8条回答
  •  盖世英雄少女心
    2020-12-02 15:40

    Of course, this is not an answer, but it shows an interesting feature of tuples:

    #include 
    #include 
    #include 
    
    using namespace std;
    
    using T = tuple <
        int,
        double,
        string
    >;
    
    vector V;
    
    int main()
    {
        V.emplace_back(42, 3.14, "foo");
    }
    

提交回复
热议问题