当前位置:网站首页>D check type is pointer
D check type is pointer
2022-06-26 13:52:00 【fqbqrr】
void main() {
char accepted_type;
char* non_accepted_type;
if (__traits(isPointer, typeof(accepted_type))) {
// Type... Is not accepted
}
else {
/* It's not a pointer , Accept */ }
if (__traits(isPointer, typeof(non_accepted_type))) {
// Type... Is not accepted
}
else {
/* It's not a pointer , Accept */ }
}
You can see Source code , here :
enum bool isPointer(T) = is(T == U*, U) && __traits(isScalar, T);
You can use is() expression :
if (is(typeof(accepted_type) == T*, T))
{
// If the accepted type matches T*, be T It's the type
// It's a pointer
}
边栏推荐
- A primary multithreaded server model
- 虫子 类和对象 中
- Global variable vs local variable
- [proteus simulation] Arduino uno key start / stop + PWM speed control DC motor speed
- It is better and safer to choose which securities company to open an account for flush stock
- Zero basics of C language lesson 8: Functions
- NVM installation tutorial
- Reprint - easy to use wechat applet UI component library
- Stack, LIFO
- Input text to automatically generate images. It's fun!
猜你喜欢

Firewall introduction

Exercise set 1

8.Ribbon负载均衡服务调用

Bigint: handles large numbers (integers of any length)

I met the problem of concurrent programming in an interview: how to safely interrupt a running thread

Use of wangeditor rich text editor

What features are added to Photoshop 2022 23.4.1? Do you know anything

ES基於Snapshot(快照)的數據備份和還原

Mysql database explanation (III)

三维向量的夹角
随机推荐
虫子 STL string 下 练习题
Aesthetic experience (episode 238) Luo Guozheng
33、使用RGBD相机进行目标检测和深度信息输出
ICML 2022 | limo: a new method for rapid generation of targeted molecules
VTK 圆柱体的生成与渲染
Wechat applet -picker component is repackaged and the disabled attribute is added -- below
[how to connect the network] Chapter 2 (next): receiving a network packet
团队管理的最关键因素
Mysql database explanation (III)
微信小程序注册指引
Tips for using nexys A7 development board resources
Luogu p3426 [poi2005]sza-template solution
Here Document免交互及Expect自动化交互
shell脚本详细介绍(四)
Postman自动化接口测试
Es sauvegarde et restauration des données par instantané
On insect classes and objects
Logical operation
Log in to the server using SSH key pair
Ring queue PHP