惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

有赞技术团队
有赞技术团队
B
Blog
IT之家
IT之家
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
量子位
博客园 - 叶小钗
T
Tailwind CSS Blog
小众软件
小众软件
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
雷峰网
雷峰网
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Blog — PlanetScale
Blog — PlanetScale
V
V2EX
博客园_首页
I
InfoQ
B
Blog RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog

博客园 - SunWentao

Man or Honor 怒海潜将,壮志潜龙 美军的Navy Dive Carl Brashear unitycn.cn 关停了 windows 开发者神器 tc – total command和替代品 c#版本与vs的对应关系 十年前的博客,今天终于又回来了 配置total commander 显示所有或特定文件夹 (带点的文件夹) 如何删除cygwin 在word中实现代码的语法高亮 最好用最方便的sqlite管理工具 日本小孩的教育 zz 2013年公司年会照片 Php Fatal error: Allowed memory size of 33554432 bytes exhausted 的解决办法 跟乌克兰人学编程1 我不怕会1000种拳法的人,但我怕只会一种拳法,练1000遍的人. by 李小龙 乌克兰人的编程习惯 换个活法:临终前会后悔的25件事 内心强大的指标 史丹佛毕业25年 我最有钱的同学是...zz 榨汁机食谱大全
c++ 11 practise -1-
SunWentao · 2013-04-12 · via 博客园 - SunWentao

c++ 11 practise -1-

2013-04-12 11:09AM

#include <iostream>
#include <array>
#include <forward_list>
#include <string>
#include <unordered_set>
using namespace std;

int main()
{
    array<int, 3> arr;
    get<0>(arr) = 1;
    get<1>(arr) = 2;
    get<2>(arr) = 3;
    cout << "(" << get<0>(arr) << get<1>(arr) << get<2>(arr) << ")" << endl;

    // forward_list
    forward_list<string> words1;// {"the", "greatest", "country", "in", "the", "world"};
    words1.push_front("the");
    words1.push_front("greatest");
    words1.push_front("salesman");
    words1.push_front("in");
    words1.push_front("the");
    words1.push_front("world");

    long double f = 23.43;
    cout << to_string(f) << endl;
    for(auto ci = words1.begin(); ci != words1.end(); ++ci)
        cout << *ci << " ";
    cout << endl;
    forward_list<string> words2(words1.begin(), words1.end());
    forward_list<string> words3(words1);
    //forward_list<string> words4 (words1.size(), "Mo");

    // unordered_set
    // set,map : based on 
    unordered_set<int> set1;
    set1.insert(343);
    set1.insert(3);
    set1.insert(34);
    set1.insert(43);
    set1.insert(33);
    set1.insert(443);
    auto d = set1.find(43);
    if(d != set1.end())
        cout << "find it" << endl;
    return 0;
}