当前位置:首页 > 报告详情

彭博_C++反射的核心原理实践与最新进展.pdf

上传人: 柒柒 编号:1268184 2026-06-13 64页 3.81MB

1、C+反射的核心原理、实践与最新进展Overview of basic C+reflection usages,applications,and ongoing workMeya Zhao,Henry Haorong Yang,Zhenchao Lin 2025 Bloomberg Finance L.P.All rights reserved.C+Reflection 101Overview of basic C+reflection usages,applications,and ongoing workCPP-SummitDecember 13,2025Meya Zhao,Henry Ha

2、orong Yang,Zhenchao LinSoftware Engineers,Real-Time Market Data FeedsWho are we?Bloomberg Feeds Engineering-We design,build,and operate exchange and contributor facing real-time market data systems-Our mandate is to model every exchange event,and propagate to downstream Bloomberg systems in real tim

3、e-We engineer for resiliency,low latency,and scale-A single one of our many applications can process hundreds of millions of events in a day3A problem in real-time market data pipelines_Case study FIXmessage-received34=160=20210830-12:34:56.789+0855=AAPL44=2.3387=44A problem in real-time market data

4、 pipelines_Case study FIXmessage-receivedC+object-representedstruct QuoteMessage unsigned long MsgSeqNum;sys_time TransactTime;std:string Symbol;double Price;int Volume;myQuoteMessage 1,2021-08-30 12:34:56.789,AAPL,2.3,4;34=160=20210830-12:34:56.789+0855=AAPL44=2.3387=45A problem in real-time market

5、 data pipelines_Case study FIXmessage-receivedC+object-representedMsgSeqNum:1,TransactTime:2021-08-30 12:34:56.789,Symbol:AAPL,Price:2.3,Volume:4JSONobject-serializedstruct QuoteMessage unsigned long MsgSeqNum;sys_time TransactTime;std:string Symbol;double Price;int Volume;myQuoteMessage 1,2021-08-3

6、0 12:34:56.789,AAPL,2.3,4;34=160=20210830-12:34:56.789+0855=AAPL44=2.3387=46Without reflectionstruct QuoteMessage .;template struct std:formatter /.auto format(const QuoteMessage&msg,FormatContext&ctx)const return std:format_to(ctx.out(),MsgSeqNum:,TransactTime:%F%T,Symbol:,Price:,Volume:,msg.d_MsgS

word格式文档无特别注明外均可编辑修改,预览文件经过压缩,下载原文更清晰!
三个皮匠报告文库所有资源均是客户上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作商用。
1. **C++反射核心原理**:通过`^^`和`[: :]`操作符实现元编程,`std::meta::info`存储反射信息,`std::meta::nonstatic_data_members_of`等元函数访问成员、基类、枚举等。 2. **实践应用**:Bloomberg利用反射构建通用JSON序列化器,自动处理结构体成员(包括私有成员)和枚举,减少重复代码。 3. **最新进展**: - 属性反射(P3385):支持枚举和检查属性(如`[[nodiscard]]`)。 - `define_aggregate`实现零成本模式迁移(如废弃字段过滤)。 4. **性能与场景**:适用于高频市场数据处理(如日处理数亿事件),强调低延迟与可扩展性。
反射如何简化序列化? 反射如何访问私有成员? 反射如何处理枚举类型?
客服
商务合作
小程序
服务号
折叠