[英]Is there a “null” value for std::thread::id?
I'd like to have a class member of type std::thread::id
where I can also nullify it and then check whether it has been set. 我想有一个类型为std::thread::id
的类成员,我也可以使它无效,然后检查它是否已经设置。
What is the best way to "nullify" this type and then check whether it has been set? “取消”此类型的最佳方法是什么,然后检查它是否已设置?
According to cppreference on std::thread::id (default constructor) : 根据std :: thread :: id(默认构造函数)上的cppreference :
Default-constructs a new thread identifier. Default-构造一个新的线程标识符。 The identifier does not represent a thread. 标识符不代表线程。
So, you can store and compare against a default constructed std::thread::id
. 因此,您可以存储和比较默认构造的std::thread::id
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.