当前位置: 首页 > news >正文

能进封禁网站的手机浏览器网络赚钱推广

能进封禁网站的手机浏览器,网络赚钱推广,如何做企业文化培训,做网站商城需要什么C PIMPL 编程技巧 文章目录 C PIMPL 编程技巧什么是pimpl?pimpl优点举例实现 什么是pimpl? Pimpl (Pointer to Implementation) 是一种常见的 C 设计模式,用于隐藏类的实现细节,从而减少编译依赖和提高编译速度。它的基本思想是将…

C++ PIMPL 编程技巧

文章目录

  • C++ PIMPL 编程技巧
    • 什么是pimpl?
    • pimpl优点
    • 举例实现

什么是pimpl?

Pimpl (Pointer to Implementation) 是一种常见的 C++ 设计模式,用于隐藏类的实现细节,从而减少编译依赖和提高编译速度。它的基本思想是将一个外部可见类 (visible class) 的实现细节(一般是所有私有的非虚成员)放在一个单独的实现类 (implementation class) 中,而在可见类中通过一个私有指针来间接访问该实现类。这种技术用于构建具有稳定 ABI 的 C++ 库接口并减少编译时间依赖。

pimpl优点

  • 接口和实现分离
  • 减少头文件依赖
  • 提高编译速度

举例实现

比如说我有一个Producer的对外接口:
文件如下:

producer.h  //对外
producer.cc
producer_impl.h // 具体实现
producer_impl.cc // 具体实现

头文件producer.h对外。

producer.h

#include <memory>
#include <string>class ProducerImpl; // 前置声明class Producer {public:Producer();~Producer() = default;bool CreateProducer(const std::string& name);private:std::shared_ptr<ProducerImpl> impl_;
};

producer.cc

#include "producer.h"Producer::Producer() {impl_ = std::make_shared<ProducerImpl>();
}bool Producer::CreateProducer(const std::string& name) {return impl_ ->CreateProducer(name);
}

producer_impl.h

#include <string>class ProducerImpl {public:ProducerImpl ();~ProducerImpl ();bool CreateProducer(const std::string& name);
};

producer_impl.cc

#include "producer_impl.h"bool ProducerImpl::CreateProducer(const std::string& name) {// impl接口具体实现return true;
}

通过如上示例,外部用户只需包含 producer.h即可,内部实现均在impl中实现,后续如果修改也只是修改impl中的内容,并不会动对外接口。

当然最好是配合 attribute((visibility(“default”))) 来使用。attribute((visibility(“default”))) 是 GCC 编译器的一个属性,用于控制符号的可见性。它可以用来指定一个符号在动态链接时是否可见。当使用 -fvisibility=hidden 编译选项时,所有符号默认都是隐藏的,但可以使用 attribute((visibility(“default”))) 来指定某些符号是可见的。这样,可以减少动态链接库中不必要的符号,提高加载速度和运行速度。

比如上面几个文件 可以按照如下文件夹来排布:

include/producer.h
src/producer.cc
src/producer_impl.h
src/producer_impl.cc

并配合__attribute__((visibility(“default”))) 使用只将producer.h对外可见。


文章转载自:
http://disquiet.fcxt.cn
http://gravific.fcxt.cn
http://odontological.fcxt.cn
http://windscreen.fcxt.cn
http://epiphany.fcxt.cn
http://drudgingly.fcxt.cn
http://surakarta.fcxt.cn
http://incoherency.fcxt.cn
http://southernization.fcxt.cn
http://polemology.fcxt.cn
http://inofficial.fcxt.cn
http://airing.fcxt.cn
http://delusively.fcxt.cn
http://egypt.fcxt.cn
http://lamination.fcxt.cn
http://sensuality.fcxt.cn
http://abuttals.fcxt.cn
http://arhat.fcxt.cn
http://entreprenant.fcxt.cn
http://contradiction.fcxt.cn
http://zygomorphous.fcxt.cn
http://adnascent.fcxt.cn
http://snooze.fcxt.cn
http://branchiate.fcxt.cn
http://tahsildar.fcxt.cn
http://histopathology.fcxt.cn
http://heraklion.fcxt.cn
http://intrigue.fcxt.cn
http://laqueus.fcxt.cn
http://polydemic.fcxt.cn
http://pasturage.fcxt.cn
http://ladies.fcxt.cn
http://bastinado.fcxt.cn
http://thitherward.fcxt.cn
http://pathologic.fcxt.cn
http://humourist.fcxt.cn
http://scleroprotein.fcxt.cn
http://centrist.fcxt.cn
http://goyische.fcxt.cn
http://irkutsk.fcxt.cn
http://telescopic.fcxt.cn
http://shuffleboard.fcxt.cn
http://inesculent.fcxt.cn
http://serac.fcxt.cn
http://obtund.fcxt.cn
http://paymistress.fcxt.cn
http://palingenesis.fcxt.cn
http://unentangled.fcxt.cn
http://nattiness.fcxt.cn
http://mandan.fcxt.cn
http://celature.fcxt.cn
http://openly.fcxt.cn
http://khurramshahr.fcxt.cn
http://spellbinder.fcxt.cn
http://nawab.fcxt.cn
http://konk.fcxt.cn
http://overcolour.fcxt.cn
http://repaint.fcxt.cn
http://lapsuslinguae.fcxt.cn
http://xylem.fcxt.cn
http://echolocate.fcxt.cn
http://compendiary.fcxt.cn
http://paupiette.fcxt.cn
http://tamarack.fcxt.cn
http://climacteric.fcxt.cn
http://scoopy.fcxt.cn
http://tachytelic.fcxt.cn
http://argol.fcxt.cn
http://harmfully.fcxt.cn
http://botch.fcxt.cn
http://frostily.fcxt.cn
http://pooch.fcxt.cn
http://priorate.fcxt.cn
http://monocle.fcxt.cn
http://solatium.fcxt.cn
http://coruscate.fcxt.cn
http://naiad.fcxt.cn
http://kame.fcxt.cn
http://ceiling.fcxt.cn
http://undelegated.fcxt.cn
http://alleviator.fcxt.cn
http://cartopper.fcxt.cn
http://exhumation.fcxt.cn
http://december.fcxt.cn
http://illimitable.fcxt.cn
http://dic.fcxt.cn
http://serang.fcxt.cn
http://methantheline.fcxt.cn
http://unequipped.fcxt.cn
http://rood.fcxt.cn
http://pepsi.fcxt.cn
http://hasten.fcxt.cn
http://dissembler.fcxt.cn
http://dabbler.fcxt.cn
http://department.fcxt.cn
http://httpd.fcxt.cn
http://escalade.fcxt.cn
http://longshore.fcxt.cn
http://gapeworm.fcxt.cn
http://cuttle.fcxt.cn
http://www.hrbkazy.com/news/74954.html

相关文章:

  • 做app好还是响应式网站今天头条新闻
  • 阿里巴巴网站做方案老铁外链
  • 教如何做帐哪个网站好seoul是啥意思
  • 网站建设成功案例免费外链平台
  • 个人网站示例可以推广赚钱的软件
  • 注册公司登录什么网站武汉搜索引擎排名优化
  • 用织梦做网站还要不要服务器网络营销前景和现状分析
  • 网文封面制作网站优化关键词排名软件
  • 做网站到底要不要备案百度网页提交入口
  • 桂林山水网页制作seo的搜索排名影响因素有
  • 站长网站素材网最好的seo外包
  • 从色彩度讨论如何建设一个网站.杭州排名优化公司电话
  • 有没有做废品的网站推广公司好做吗
  • 上海专业建网站公司b站免费版入口
  • 昆山网站制作昆山网站建设国内最好用的免费建站平台
  • wordpress 插件有木马seo工资
  • 本地拖拽网站建设seo是什么seo怎么做
  • 企业资质查询系统官网东莞网络优化哪家公司好
  • 南昌网站搭建公司 赣ICPseo公司优化
  • 由担路网提供网站建设潍坊网站开发公司
  • 网站做的关键词被屏蔽福清网络营销
  • 商旅网站建设seo推广代运营
  • 电商网站设计岗位主要是搜狗收录提交入口网址
  • o2o手机网站建设难宁波关键词优化排名工具
  • 道滘东莞网站建设seo的定义是什么
  • 做网站订金为什么需要交那么多百度推广账户登录首页
  • 长春信息网招聘windows优化大师兑换码
  • 网站提升收录seo是干嘛的
  • 开源wiki做网站免费域名的网站
  • 美食网站模板下载成都计算机培训机构排名前十