小编xvn*_*vnm的帖子

模板演绎指南似乎不起作用

在"C++模板完整指南"之后,我编写了以下代码:

#include <vector>
#include <cassert>
#include <string>

template <typename T, typename Cont = std::vector<T>>
class Stack
{
    public:
        Stack() = default;

        Stack(T elem) :
            elems({std::move(elem)})
        { }

        auto push(T const& elem)       -> void;
        auto pop()                     -> void;
        auto top()               const -> T const&;
        auto empty()             const -> bool
        {
            return elems.empty();
        }

    private:
        Cont elems;
};

Stack(char const*) -> Stack<std::string>;

template <typename T, typename Cont>
auto Stack<T, Cont>::push(T const& elem) -> void
{
    elems.push_back(elem);
}

template <typename T, typename Cont> …
Run Code Online (Sandbox Code Playgroud)

c++ templates c++17

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

如何区分Hyperledger Fabric中`cryptogen`生成的客户端和对等证书?

我已使用生成了证书cryptogen

并检查了生成的证书,openssl并注意到该证书缺少可用于区分对等角色和客户端角色的信息。我相信admin可以区分,因为管理证书是用区块链编写的,但是没有有关客户端和对等方的信息。

Certificate:
    Data:
        Version: 3 (0x2)
        Signature Algorithm: ecdsa-with-SHA256
        Issuer: C = US, ST = California, L = San Francisco, O = test.com, CN = ca.test.com
        Validity
            Not Before: Sep 19 01:49:00 2019 GMT
            Not After : Sep 16 01:49:00 2029 GMT
        Subject: C = US, ST = California, L = San Francisco, CN = User1@test.com
...
Run Code Online (Sandbox Code Playgroud)
Certificate:
    Data:
        Version: 3 (0x2)
        Signature Algorithm: ecdsa-with-SHA256
        Issuer: C = US, ST = California, L …
Run Code Online (Sandbox Code Playgroud)

hyperledger-fabric

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

标签 统计

c++ ×1

c++17 ×1

hyperledger-fabric ×1

templates ×1