请在下面找到代码片段:
class tFunc{
int x;
public:
tFunc(){
cout<<"Constructed : "<<this<<endl;
x = 1;
}
~tFunc(){
cout<<"Destroyed : "<<this<<endl;
}
void operator()(){
x += 10;
cout<<"Thread running at : "<<x<<endl;
}
int getX(){ return x; }
};
int main()
{
tFunc t;
thread t1(t);
if(t1.joinable())
{
cout<<"Thread is joining..."<<endl;
t1.join();
}
cout<<"x : "<<t.getX()<<endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我得到的输出是:
Constructed : 0x7ffe27d1b0a4
Destroyed : 0x7ffe27d1b06c
Thread is joining...
Thread running at : 11
Destroyed : 0x2029c28
x : 1
Destroyed : 0x7ffe27d1b0a4 …Run Code Online (Sandbox Code Playgroud) 我正在使用Material ui 的选项卡,并且能够对选项卡的指示器进行更改。但是,我正在尝试使用样式将指示器的宽度减小到每个选项卡的固定宽度。但似乎指标的位置靠左并带有一些计算值,并且给它一个宽度不会使指标居中对齐。找不到合适的解决方案,请帮助我。这是可编辑的CodeSandbox。
找到以下片段: