A system for reflection in C++

A system for reflection in C++
复制标题

C 语言的反射系统

DOI:
--
复制
发表时间:
2004
期刊:
ArXiv
影响因子:
--
通讯作者:
R. Standish
R. Standish
中科院分区:
--
文献类型:
--
作者:
Duraid Madina;R. Standish

文献摘要

被引文献

相似文献

以对象为导向的编程语言(例如Java和Objective C)在实现基于代理和基于对象的基于对象的模拟方面很受欢迎,因为这些语言中的对象可以{\ em反射}(即对对象结构进行运行时查询)。例如,这允许一个相当微不足道的{\ em serialization}例程(将对象转换为二进制表示形式,可以存储或通过网络存储或传递)要编写。但是,C ++不提供此功能,因为类型信息在编译时被丢弃。然而,C ++通常是首选的开发环境,无论是出于绩效原因还是出于其表现力的特征,例如操作员过载。在本文中,我们介绍{\ em classDesc}系统,该系统将对象反射的许多好处带入C ++。
Object-oriented programming languages such as Java and Objective C have become popular for implementing agent-based and other object-based simulations since objects in those languages can {\em reflect} (i.e. make runtime queries of an object's structure). This allows, for example, a fairly trivial {\em serialisation} routine (conversion of an object into a binary representation that can be stored or passed over a network) to be written. However C++ does not offer this ability, as type information is thrown away at compile time. Yet C++ is often a preferred development environment, whether for performance reasons or for its expressive features such as operator overloading. In this paper, we present the {\em Classdesc} system which brings many of the benefits of object reflection to C++.