当前位置:网站首页>d使用among的问题
d使用among的问题
2022-07-30 21:46:00 【fqbqrr】
import std.stdio;
import std.string;
import std.conv;
import dcollect;
import std.math;
import std.algorithm;
int main(string[] args)
{
int[] x=[23, 34,-88, 54, -90, -34];
auto y=x.filter!(a=>a<0);
foreach(i; y)
i.write(", ");
54.among(to!uint[10](y)).writeln;
return 0;
}
.among用于列表在编译时已知大小或固定的情况.如果是运行时,要用canFind.
if ([1, 2, 3, 4].canFind(3))
writeln("found it!");
或用find
auto r = [ 1, 2, 3, 4 ].find(3);
assert(r.front == 3);
边栏推荐
- The most powerful and most commonly used SQL statements in history
- How strict Typescript strict mode?
- MySQL 5.7 detailed download, installation and configuration tutorial
- cookie和session区别
- Advanced c language: pointers (5)
- Difference between cookie and session
- Installation and use of cnpm
- 基于ABP实现DDD--实体创建和更新
- 解决centos8 MySQL密码问题ERROR 1820 (HY000) You must reset your password using ALTER USER
- 【Nacos】解决Nacos下载速度缓慢的问题
猜你喜欢

navicat无法连接mysql超详细处理方法

解决centos8 MySQL密码问题ERROR 1820 (HY000) You must reset your password using ALTER USER

A simple rich text editor

【菜鸡含泪总结】如何用pip、anaconda安装库

MySQL cursors

MySQL 5.7 detailed download, installation and configuration tutorial

数据指标口径不统一、重复开发?亿信ABI指标管理平台帮你解决

MySQL 8.0.29 decompressed version installation tutorial (valid for personal testing)

The mysql time field is set to the current time by default

openim支持十万超级大群
随机推荐
uni-app开发微信小程序踩坑
Uni-app 小程序 App 的广告变现之路:激励视频广告
Typescript 严格模式有多严格?
走进Redis,让你重新认识redis。绝不是表面
设备树的引入与体验
Navicat connection MySQL error: 1045 - Access denied for user 'root'@'localhost' (using password YES)
MySQL 5.7详细下载安装配置教程
go语言慢速入门——流程控制语句
The structure of knowledge in the corners of the C language
MySql创建数据表
【零代码工具】15 款企业级零代码开发平台推荐,总有一款是你心仪的
MySql 5.7.38下载安装教程 ,并实现在Navicat操作MySql
ValueError: Append mode is not supported with xlsxwriter解决方案
共用体、共用体与结构体的区别、枚举之C语言犄角旮旯的知识
Knowledge of C language corners of byte alignment
ClickHouse删除数据之delete问题详解
登堂入室之soc开发makefile
MySQL 有这一篇就够(呕心狂敲37k字,只为博君一点赞!!!)
你需要知道的ES6—ES13开发技巧
navicat无法连接mysql超详细处理方法