当前位置:网站首页>Expansion of D @nogc
Expansion of D @nogc
2022-06-12 06:57:00 【fqbqrr】
import std.traits;
// Convert from a function or closure type `@nogc`
auto assumeNoGC(T) (T t) if (isFunctionPointer!T || isDelegate!T)
{
enum attrs = functionAttributes!T | FunctionAttribute.nogc;
return cast(SetFunctionAttributes!(T, functionLinkage!T, attrs)) t;
}
// Can't press `@nogc` Marker function , But you know you don't use garbage collection
void funcThatMightUseGC(int timeout)
{
if (unlikelyCondition(timeout))
throw new Exception(" Thrown ");
doMoreStuff();
}
void funcThatCantAffortGC() @nogc
{
// Call garbage collection with transformation closure .
assumeNoGC( (int timeout)
{
funcThatMightUseGC(timeout);
})(10000);
}
边栏推荐
- Zhang Chi: is process a panacea?
- Postman splice replacement parameter loop call interface
- Curry carries the fourth game of the warriors against the Celtics
- Noi openjudge computes the n-th power of 2
- I met 15 people recently and found that I couldn't answer the basic question of this test
- Descscheduler secondary scheduling makes kubernetes load more balanced
- MySQL group query to obtain the latest data date function of each group
- 张驰课堂:2022年CAQ中质协六西格玛考试时间通知
- 报表工具的二次革命
- leetcode:890. Find and replace mode [two dict records set]
猜你喜欢
![Leetcode: Sword finger offer 66 Build product array [application of pre and post infix]](/img/de/cd98d4d86017a13ec4172ba3054e99.png)
Leetcode: Sword finger offer 66 Build product array [application of pre and post infix]

库里扛起了勇士对凯尔特人的第四场

Kali与编程:如何快速搭建OWASP网站安全实验靶场?

Process when solving vagrant up_ builder. rb:43:in `join‘: incompatible character encodings: GBK and UTF-8

Category 7

SQL Server 2019 installation error. How to solve it

Zhang Chi's class: Notice on the time of CAQ Six Sigma test in 2022

丢掉丑陋的 toast,会动的 toast 更有趣

Scons编译IMGUI

Jackson XML is directly converted to JSON without writing entity classes manually
随机推荐
"I was laid off by a big factory"
Leetcode: Sword finger offer 66 Build product array [application of pre and post infix]
esp32 hosted
leetcode.39 --- 组合总和
Curry carries the fourth game of the warriors against the Celtics
libprint2
Zhang Chi's class: Notice on the time of CAQ Six Sigma test in 2022
d的扩大@nogc
[image denoising] image denoising based on partial differential equation (PDE) with matlab code
【图像去噪】基于偏微分方程(PDE)实现图像去噪附matlab代码
Matlab 6-DOF manipulator forward and inverse motion
leetcode:890. Find and replace mode [two dict records set]
“我被大厂裁员了”
SQL injection - blind injection
Codeforces Round #793 (Div. 2) A B C
Deep and detailed analysis of PHP one sentence Trojan horse
The principle of SQL injection is to build sqli labs, and SQL injection is simple and practical
Interview intelligence questions
2 variables and basic types
Unable to load bean of class marked with @configuration