当前位置:网站首页>Callback uses lambda
Callback uses lambda
2022-07-27 06:06:00 【Mr FF】
// lambda_callable.cpp
#include <iostream>
using namespace std;
template <typename T, typename Func>
void ForEach(T* begin, T* end, const Func& func)
{
while (begin != end) {
func(*begin++);
}
}
int main(int argc, char **argv)
{
int array[] = {10, 11, 23, 25, 30};
ForEach(array, array + 5, [] (auto&x) {cout << x << " ";});
return 0;
}Compile implementation
g++ -o lambda_callable lambda_callable.cpp -std=c++14
10 11 23 25 30边栏推荐
- 韦东山 数码相框 项目学习(二)在LCD上显示中文字符
- [concurrent programming series 9] priorityblockingqueue, delayqueue principle analysis of blocking queue
- 【头歌】重生之我在py入门实训中(3): if条件语句
- C语言-文件操作
- [song] rebirth of me in py introductory training (10): numpy
- Unittest套件与运行器
- 对于windows下的Redis,只能读不能写的问题
- 个人开发者申请代码签名证书的签发流程
- 代码随想录笔记_哈希_242有效的字母异位词
- Stm32-fsmc extended memory SRAM
猜你喜欢

Can it replace PS's drawing software?

韦东山 数码相框 项目学习(四)简易的TXT文档显示器(电纸书)

2021-06-26

Chrome 如何快速将一组正在浏览的网页(tabs)转移到另一台设备(电脑)上

When multiple formulas in latex share a sequence number

Xmind 思维导图 2022 v12.0.3中文版更新了哪些内容?

PS 2022 updated in June, what new functions have been added

Essential tool for making video special effects: nuke 13

Day 3. Suicidal ideation and behavior in institutions of higher learning: A latent class analysis

STM32-红外遥控
随机推荐
cycleGAN解析
力扣160. 相交链表
基于C#的Winform对Access数据库进行操作(mdb结尾)
【Unity URP】代码获取当前URP配置UniversalRendererData,并动态添加RendererFeature
开源WebGIS-相关知识
【头歌】重生之我在py入门实训中(12):Matplotlib接口和常用图形
超强远程连接管理工具:Royal TSX
力扣题解 动态规划(4)
WebODM win10安装教程(亲测)
IOT operating system
【头歌】重生之我在py入门实训中(2):公式编程
geonode geoserver win10 安装教程(亲测)
Gbase 8C - SQL reference 6 SQL syntax (14)
【头歌】重生之我在py入门实训中(3): if条件语句
[first song] rebirth of me in py introductory training (6): definition and application of functions
Redis在windows下的idea连接不上问题
[MySQL learning] 8
Chrome 如何快速将一组正在浏览的网页(tabs)转移到另一台设备(电脑)上
Dpdk network protocol stack VPP OVS DDoS Sdn nfv virtualization high performance expert Road
【第一篇博客-展望】