Boost logo

Boost :

Subject: Re: [boost] [intro] Preview: Introspection library
From: Stefan Strasser (strasser_at_[hidden])
Date: 2010-06-29 18:21:52

Zitat von David Sankel <camior_at_[hidden]>:

> On Mon, Jun 28, 2010 at 8:00 AM, Stefan Strasser
> <strasser_at_[hidden]> wrote:
>> I'd be interested in comments on an introspection library I've been
>> developing.
> You may find paper "Scrap++: Scrap Your Boilerplate in C++"[1] to be
> interesting for ideas. One thing that confuses me about your library

thanks. (direct link: )

do I understand the paper correctly that you can't traverse two
instances of a type at the same time?
that's a central part to my approach. the (const) traversal of a
single instance could have been accomplished with the Serializable
concept, but algorithms like copying or comparing objects could only
be implemented very inefficiently by serialization.

> is I don't know whether the reflections are semantic or syntactic. I
> do think a clear separation of syntax and semantics is important to
> writing clear code. Perhaps you can show what a shared_ptr
> "implementation of the concept" looks like?

it depends on the shared_ptr implementation if you'd actually
implement introspect() for shared_ptr, but I guess you mean supporting
shared_ptr in a specific algorithm.
apply_recursive, which seems to be comparable to scrap++:

template<class F,class Data,class T,class Semantics>
void apply_recursive(F const &f,Data &data,shared_ptr<T> &ptr,Semantics){

this function is found via ADL.
apply_member_recursive calls f(*ptr), but only after polymorphic
dispatch if needed, and after it has been checked that *ptr hasn't
already been traversed, e.g. through another pointer.

> Fusion's adapters, which are purely syntactic, are perfect for what
> I've needed so far. Syntactically speaking, are you adding anything
> besides data inheritance?

I'm not familiar with that distinction wrt reflection.


Boost list run by bdawes at, gregod at, cpdaniel at, john at