小编tte*_*tle的帖子

如何解决代理后面的 npm install 期间的连接问题?

我按照说明操作:https : //www.electronjs.org/docs/tutorial/first-app

我输入mkdir,cdnpm 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)

javascript proxy node.js npm electron

6
推荐指数
1
解决办法
6067
查看次数

如何将没有自定义删除器的 unique_ptr 移动到另一个具有自定义删除器的 unique_ptr?

#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 呢?

谢谢你的帮助!

c++ unique-ptr move-semantics

1
推荐指数
1
解决办法
650
查看次数

标签 统计

c++ ×1

electron ×1

javascript ×1

move-semantics ×1

node.js ×1

npm ×1

proxy ×1

unique-ptr ×1