微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

前向声明后,我不能在同一命名空间中使用其他类

如何解决前向声明后,我不能在同一命名空间中使用其他类

我希望得到一些帮助。

我在命名空间中转发声明的类 Stub。

print(sum(value for key,value in dic.items() if key >= threshold) / num_to_be_divided)

在源代码中,我想使用来自同一命名空间的 newStub:但收到错误消息:命名空间 'License::Grpc::Testservice' 中没有名为 'NewStub' 的成员 没有预先声明就可以了。

#ifndef SERVERACCESS_HPP
#define SERVERACCESS_HPP

#include <memory>

namespace License {
namespace Grpc {
namespace Testservice{
class Stub;
}}}//namespace License::Grpc::Testservice

namespace grpc {
class Channel;
} //namespace grpc

class AccesstoServer final {
    public:
    AccesstoServer(const char* serverAdress,const int port);

    private:
    std::shared_ptr<grpc::Channel> ChannelToSever;
    std::unique_ptr<License::Grpc::Testservice::Stub> Stub;
};

#endif //SERVERACCESS_HPP

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。