我按照说明操作:https : //www.electronjs.org/docs/tutorial/first-app
我输入mkdir,cd和npm init。他们都工作得很好。package.json出现了一个名为的文件。
然后我输入npm install --save-dev electron. 发生了一些错误。
lala@ubu:~/projects/electron/my-app 17:20:34
$ npm install --save-dev electron
> core-js@3.6.4 postinstall /home/lala/projects/electron/my-app/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a …Run Code Online (Sandbox Code Playgroud) #include <memory>
#include <functional>
#include <iostream>
struct TestStruct {
int a = 100;
};
struct StructDeleter {
void operator()(TestStruct *ptr) const {
delete ptr;
}
};
std::unique_ptr<TestStruct, StructDeleter> MakeNewStruct() {
std::unique_ptr<TestStruct> st(new TestStruct());
std::unique_ptr<TestStruct, StructDeleter> customDeleterSt(std::move(st));
std::cout << customDeleterSt->a << std::endl;
return customDeleterSt;
}
int main() {
auto a = MakeNewStruct();
std::cout << a->a << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
上面的代码无法编译,如何st移至customDeleterSt?我st从创建界面获得了一个 unique_ptr st,并使用自定义删除器对用户隐藏了 的实现st,那么如何将没有自定义删除器的 unique_ptr 移动到具有自定义删除器的 unique_tr 呢?
谢谢你的帮助!