Boost logo

Boost :

Subject: Re: [boost] Is there any interest in a library which solves C++ class reflection feature just like Java does?
From: Matus Chochlik (chochlik_at_[hidden])
Date: 2011-12-06 07:09:51


On Tue, Dec 6, 2011 at 2:40 AM, jinhua luo <ljh.home.king_at_[hidden]> wrote:
> Hi,

Hi,
>
> In brief, I'd designed and implemented somehow C++ class reflection based
> on boost libraries.

Did you have a look at the Mirror reflection utilities ?

> It has some unique advantages:
> a) it doesn't require code generator

Good, but it is not so unique

> b) platform independent and compiler independent (I tested it on Windows
> and Linux, with vs2008 and gcc respectively)

Nice,

> c) it's non-intrusive for the class definition, instead, you just need to
> declare and describe your class via some straightforward macros anywhere
> (header file or source file, and may be within any namespace), which also
> means you can wrap an external third-party library (which you have no way
> to touch the source codes) and reflects it classes.

This is not unique either

> d) Cross shared library boundary, you can dynamic load the shared library
> and reflect the classes within it, without need to export any symbol
> manunally in C wrapper function way

I believe (and I have some expertise in using and implementing reflection
in C++ to base that belief upon) that the basic reflection should
compile-time and any run-time reflection should be built on top
of that.

> e) the API looks like Java reflection API

I don't think that this is a good idea, and I've seen several
(scientific) papers where people don't think it either.

BR

Matus


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk