c++11新性能测试4
来源:互联网 发布:淘宝上卖零食怎么样 编辑:程序博客网 时间:2024/05/23 22:00
#include<iostream>#include<vector>#include <algorithm>using namespace std;vector<vector<int>> func(){ vector<vector<int>> vv; int a[] = {1,2,3,4,5}; int b[] = {6,2,3,4,5}; int c[] = {5,2,2,4,5}; vv.push_back(vector<int>(a, a+5)); vv.push_back(vector<int>(b, b+5)); vv.push_back(vector<int>(c, c+5)); return vv;}void print(vector<vector<int>> &vv){ for(auto &v : vv) { for_each(v.begin(), v.end(), [](int val){cout << val << " ";}); cout << endl; }}void test(){ [](){cout <<" This is a lambda test!" << endl;}();}void lambda_test1(){ int x=0, y=0; [&](){++x; ++y;}(); cout << "x = " << x << " y=" << y << endl;}void lambda_test2(){ int m=0, n=0; [=](){ //++m; ++n; build error: increment of read-only variable 'm,n' //按值捕获,这些变量在lampda内部是只读的 //其它捕获方式,[a,&], [&a, =] cout << "m= " << m <<" n=" << n << endl; }(); cout << "m= " << m <<" n=" << n << endl;}int main(){ auto &&vv = func(); print(vv); test(); lambda_test1(); lambda_test2(); return 0;}
0 0
- c++11新性能测试4
- C++11新性能测试
- c++11新性能测试2
- c++11新性能测试3
- 性能测试新利器,HyperPacer
- oracle 11g新特性,UNPIVOT 性能测试
- 新系统如何确定性能测试目标
- 性能测试新法宝:performance.now()
- C-NCAP和性能测试
- 性能测试4-测试计划
- 性能测试4-测试计划
- 独家:Java 7新特性及简单性能对比测试
- Java 7新特性及简单性能对比测试
- Java 7新特性及简单性能对比测试
- fio性能测试工具新添图形前端gfio
- LR性能测试经验总结(持续跟新中)
- for循环 forEach 新循环 用法及性能测试
- fio性能测试工具新添图形前端gfio
- leetcode 刷题之路 68 Gas Station
- C语言中常用文件读写命令总结
- EasyARM i.mx287学习笔记——minicom配置和使用
- NSUserDefaults的简单使用
- Unity3D脚本:边缘高光脚本
- c++11新性能测试4
- 设计模式之迭代器模式
- JAVA模式之复合模式(composite)思考与应用
- 黑马程序员-异常
- GoJs的学习资源
- C语言中的转义字符
- 文件名过长无法删除
- 对‘pthread_create’未定义的引用
- Java Composition toString()