3.多线程传参,以及tuple数组
#include <Windows.h>
#include <thread>
#include <iostream>
#include <tuple>
using namespace std; void run()
{
MessageBox(, L"hello", L"hello", );
} void runA(const wchar_t *s, const wchar_t *b)
{
MessageBox(, s, b, );
} class myclass
{
public:
void operator()()//C++重载
{
MessageBox(, L"hello", L"hello", );
}
}; void main1()
{
thread t1[]{ thread(run),thread(run),thread(run) }; thread *p1 = new thread(run);
thread *p2 = new thread(run); thread *p(new thread[]{ thread(run),thread(run),thread(run) });
//伪函数
thread t3[]{ thread(myclass()),thread(myclass()) ,thread(myclass()) };
system("pause");
} void main()
{
//多线程带参数
thread t1(runA, L"木头人1", L"HELLO");
thread t2(runA, L"木头人1", L"HELLO");
thread t3(runA, L"木头人1", L"HELLO"); //tuple数组
char ch = 'X';
short sh = ;
int num = ;
char *p = "木头人";
tuple<char, short, int, char *>mytuple(ch, sh, num, p);
auto i0 = get<>(mytuple);
cout << i0 << endl;
auto i1 = get<>(mytuple);
cout << i1 << endl;
auto i2 = get<>(mytuple);
cout << i2 << endl;
auto i3 = get<>(mytuple);
cout << i3 << endl;
cin.get();
}
3.多线程传参,以及tuple数组的更多相关文章
- C# 多线程传参
using System; using System.Threading; //多线程调试: 2013.10.08 namespace ThreadExample { class App { publ ...
- JAVA为什么不能通过构造函数传参来设置数组长度。
今天我们来说说 JAVA通过构造函数传递的参数来设置数组长度的问题. 问题在于我们没有明确知晓JVM的运行顺序.在new对象的时候,先调用构造函数,但是并没有将执行构造函数的代码,随机之后就初始化了 ...
- C# 多线程传参 三种实例
//using Thread to download files //1111111111111111 foreach (var str in listDownloadPdf) { //string ...
- Windows10 VS2017 C++多线程传参和等待线程结束
#include "pch.h" #include <iostream> #include <windows.h> using namespace std; ...
- c/c++ 数组传参
在c/c++中,在进行数组传参时,数组的元素个数默认是不作为实参传入调用函数,也就是说c/c++ 不允许向函数传递一个完整的数组作为参数 实例: 1.形式参数是一个指针,实参包括数组长度: 1 voi ...
- Java方法:命令行传参,重载,可变参数,递归
Java方法:System.out.println()//系统类.out对象.输出方法Java方法是语句的集合,他们在一起执行一个功能方法是解决一类问题的步骤的有序组合方法包含于类或对象中方法在程序中 ...
- Java学习小结(1)-数组的创建与传参
(一)数组的创建 数组的创建包括两部分:数组的申明与分配内存空间. int score[]=null; //申明一维数组 score=new int[3]; //分配长度为3的空间 数组的申明还有另外 ...
- c指针与数组,传参问题,指针数组与数组指针的区别,二维数组动态内存分配
一 数组的结构:顺序存储,看谭浩强中的图,牢记 1.数组名指代一种数据结构:数组 现在可以解释为什么第1个程序第6行的输出为10的问题,根据结论1,数组名str的内涵为一种数据结构,即一个长度为10的 ...
- c++数组传参
最近感觉老是碰到数组传参的问题,特别是二维的数组,每次报错都感觉头疼,烦躁:这里必须总结一下了,先把暂时能解决的问题写在这吧,以便以后碰到查看! 先看一个一维数组传参:这样用数组传参是很不安全的:会输 ...
随机推荐
- kentico在使用局域网ip访问的时候提示Missing license或者Invalid website
Missing license Requested URL: http://172.31.212.20/kentico10/ License status: Missing license If yo ...
- USACO 2.2 Preface Numbering
Preface Numbering A certain book's prefaces are numbered in upper case Roman numerals. Traditional R ...
- 杂项-DB:DW/DWH(数据仓库)
ylbtech-杂项-DB:DW/DWH(数据仓库) 数据仓库,英文名称为Data Warehouse,可简写为DW或DWH.数据仓库,是为企业所有级别的决策制定过程,提供所有类型数据支持的战略集合. ...
- oracle故障处理之删除大表空间hang住
背景 数据库分区表数据越来越大,需要对过期话的数据进行迁移,以及大的分区表需要进行数据的清理和删除,达到释放磁盘空间的目的. 问题说明 环境:linux 6.X 数据库:oracle 11.2.0.4 ...
- struts2学习之基础笔记6
第十一章 Struts 2的国际化 1 国际化简介 http协议,request_locale值 Locale类àà封装类request_locale值 ResourcesBandleàà ...
- vue2.x directive - 限制input只能输入正整数
onlyNum.js import Vue from 'vue' //只对input生效 export default function (el) { var input = el; input.on ...
- 使用JS&jQuery改善用户体验
第一章 JavaScript基本语法 一.运算符 运算符就是完成操作的一系列符号,它有七类: 赋值运算符(=,+=,-=,*=,/=,%=,<<=,>>=,|=,&= ...
- Apache负载均衡配置
使用mod_proxy 配置Apache负载均衡 1.安装apache ./configure --prefix=/usr/local/apache2 –enable-so make &&am ...
- LeetCode(11)Container With Most Water
题目如下: 题目的意思是求容器能装的最大的水量,当时我按梯形的面积来算,一直不对,后来才发现要按矩形的面积来算 Python代码如下: def maxArea(self, height): " ...
- 01《UML大战需求分析》阅读笔记之一
在大二的时候就已经在课堂上对UML也就是统一建模语言有了初步的了解,但是却不怎么明白,虽然可以画图可以完成任务,但是有些糊里糊涂.所以特地把这门书作为精读书籍,想要更加深度地学习UML.很多内容只用语 ...