有没有办法改变Xcode的Git用户名和电子邮件?当我尝试提交时,它将发布我的真实姓名.我希望它发布我的GitHub用户名,以便您可以在GitHub上将提交链接到我的用户.
通常使用Git我只能输入git config --global user.name whoosh
终端,但它似乎不适用于Mac和Xcode.
可能重复:
C++:std :: thread的简单返回值?
无论如何从std :: thread获取返回代码?我有一个函数返回一个整数,我希望能够在线程完成执行时从函数中获取返回代码.
让我展示一下我的意思.
#include <functional>
#include <iostream>
class MyClass
{
private:
int number;
public:
MyClass()
{
number = 0;
}
void printNumber()
{
std::cout << "number is " << number << std::endl;
number++;
}
};
int main()
{
std::shared_ptr<MyClass> obj = std::make_shared<MyClass>();
auto function = std::bind(&MyClass::printNumber, obj);
function();
// This deallocates the smart pointer.
obj.reset();
// This shouldn't work, since the object does not exist anymore.
function();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这输出:
number is 0
number is 1
Run Code Online (Sandbox Code Playgroud)
如果我们像通常那样调用函数,将"function()"替换为"obj-> printNumber()",则输出为:
number is 0 …
Run Code Online (Sandbox Code Playgroud)