小编Ola*_*del的帖子

const方法中decltype的结果

C++ 11 decltype返回给出的表达式的类型(主要是).但这可能与表达式的类型不同,因为它实际上是可访问的:

template<typename T>
struct Ref {
    Ref(T&) { }
};

#define GETTYPE decltype
//#define GETTYPE typeof

struct Problem {
    void doit_c() const { Ref<GETTYPE(n)> rn{n}; }
    void doit_nc()      { Ref<GETTYPE(n)> rn{n}; }
    int n;
};

int main() {
    int i;
    const int ci = 0;
    Problem pr;

    // decltype == typeof == int
    Ref<GETTYPE(i)> ri{i};
    pr.doit_nc();

    // decltype == typeof == const int
    Ref<GETTYPE(ci)> rci{ci};
    Ref<GETTYPE(static_cast<const int&>(i))> rcci{static_cast<const int&>(i)};

    // typeof == const int, decltype == int …
Run Code Online (Sandbox Code Playgroud)

c++ typeof decltype c++11

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

Gitlab运行程序:无法登录到GitLab容器注册表

gitlab-runner设置为具有executor的Docker容器后docker,我无法运行任何构建。显示的日志如下所示:

Running with gitlab-runner 11.4.2 (cf91d5e1)
  on <hostname> 9f1c1a0d
Using Docker executor with image docker:stable-git ...
Starting service docker:stable-dind ...
Pulling docker image docker:stable-dind ...
Using docker image sha256:acfec978837639b4230111b35a775a67ccbc2b08b442c1ae2cca4e95c3e6d08a for docker:stable-dind ...
Waiting for services to be up and running...
Pulling docker image docker:stable-git ...
Using docker image sha256:a8a2d0da40bc37344c35ab723d4081a5ef6122d466bf0a0409f742ffc09c43b9 for docker:stable-git ...
Running on runner-9f1c1a0d-project-1-concurrent-0 via a7b6a57c58f8...
Fetching changes...
HEAD is now at 5430a3d <Commit message>
Checking out 5430a3d8 as master...
Skipping Git submodules setup
$ …
Run Code Online (Sandbox Code Playgroud)

gitlab docker gitlab-ci gitlab-ci-runner

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

标签 统计

c++ ×1

c++11 ×1

decltype ×1

docker ×1

gitlab ×1

gitlab-ci ×1

gitlab-ci-runner ×1

typeof ×1