c++ - Postcondition: this->get_id()==thread::id() in Boost
问题描述
In reading the thread management section of the Boost documentation, I see the following under "Default Constructor":
Postconditions:
this->get_id()==thread::id()
I understand that this->get_id()
returns the current thread's ID, but what does thread::id()
do? I can't seem to find thread::id()
in the documentation.
What is the meaning of Postconditions?
I had originally understood Postconditions to be return values, but that understanding doesn't make sense with the default constructor documentation.
解决方案
thread::id()
thread::id
是使用默认构造函数构造的类型的对象。默认构造的 id 对象不代表线程,所有默认构造的 id 对象比较相等。简而言之,对象的默认构造thread
函数创建一个不代表执行线程的对象。
推荐阅读
- python - 根据其他行值填充 Pandas DataFrame NaN 值的最佳方法是什么?
- python - 需要使用python脚本调出菜单
- javascript - 通过重新分配使对象属性不可更改,但在 JavaScript 中可修改
- jasmine - 如何为量角器中每个测试运行的屏幕截图指定规格名称
- c++ - 分配器如何与 std::vector 一起工作?
- .net - 多租户平台认证授权架构推荐
- javascript - 带按钮的 Toggle() 方法
- laravel - Laravel:具有 Servcie 容器的实例上的不同实现
- r - 在 R stringr 中第 n 次出现后匹配
- algorithm - 我们能解决这种 DP 中的 0-1 Multiple Knapsack 问题吗?