首页 > 编程语言 > 详细

C++ 练习记录1--vector<T> 中T的初始化

时间:2014-12-31 18:14:48      阅读:225      评论:0      收藏:0      [点我收藏+]
//编译环境: vs2013 32位win8操作系统
#include <tuple>
#include <vector>
#include <iostream>
using std::cout;
using std::endl;

class A
{
    int x = 0;
public:
    A();
    ~A();

private:

};

A::A()
{
}

A::~A()
{
}

int main()
{

    std::tuple<A, intfloat> t;//这里会调用A()
          std::vector<A> va(1); //这里会调用A()
    std::list<A> va(1);//这里会调用A()

    cout << std::get<1>(t) << endl;//0
    cout << std::get<2>(t) << endl;//0
    getchar();
    return 0;
}

C++ 练习记录1--vector<T> 中T的初始化

原文:http://www.cnblogs.com/likeatree/p/4195941.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!