Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #201

Re: limited reflection proposal for C++

Message-ID <j0d65i$7a7$1@news.albasani.net> (permalink)
Newsgroups comp.std.c++
From BGB <cr88192@hotmail.com>
Subject Re: limited reflection proposal for C++
Organization albasani.net
References <0453f0ca-78a8-4315-ae4d-5b3a922054b3@fq4g2000vbb.googlegroups.com>
Date 2011-07-28 16:28 -0600

Show all headers | View raw


On 7/22/2011 9:07 AM, Andrzej Krzemieński wrote:
>
> Hi everyone,
> I intend to propose a small reflection-like utility for the next C++
> standard (which would be something like C++16?). My proposal is still
> in progress, but I would like to collect input from you as early as it
> is possible. I would appreciate your feedback.
> Here is the current description.
> https://docs.google.com/document/pub?id=18Jr3UfvQvbWh2pXQ4Wm4e8-PYdV2aTXpPtNNOicgGjw
>
> Regards,
> &rzej
>


skim... admittedly I don't entirely follow.


why not something that can be implemented primarily as library 
functionality?

struct Foo
{
	int x;
	int y;

	void fooMethod();
};

using meta;

Foo *obj;
mtStruct *ts;
mtField *tf;
mtType *tt;
mtMethod *tm;
int i;

ts=mtGetStruct("Foo");
tf=ts->getField("x");

obj=(Foo *)ts->newInstance();

i=tf->ptrGetValuei(obj);	//get value for an object field

i=tf->offsetOf();	//get field offset
tt=tf->getType();

if(tt->typeIs(mtParseType("int")))	//type-check
{
	...
}

tm=ts->getMethod("fooMethod", "()");
tm->ptrInvokev(obj);

...


in my projects, I have a system which serves a vaguely similar role, but 
it is for plain C and it works a bit differently (its APIs are notably 
different, ...).


-- 
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

limited reflection proposal for C++ Andrzej Krzemieński<akrzemi1@gmail.com> - 2011-07-22 10:07 -0600
  Re: limited reflection proposal for C++ BGB <cr88192@hotmail.com> - 2011-07-28 16:28 -0600
    Re: limited reflection proposal for C++ Andrzej Krzemieński <akrzemi1@gmail.com> - 2011-07-30 13:13 -0600
      Re: limited reflection proposal for C++ BGB <cr88192@hotmail.com> - 2011-07-31 17:09 -0600
  Re: limited reflection proposal for C++ Daniel Krügler <daniel.kruegler@googlemail.com> - 2011-07-28 16:24 -0600
  Re: limited reflection proposal for C++ Jeff Flinn <TriumphSprint2000@hotmail.com> - 2011-07-30 13:16 -0600
    Re: limited reflection proposal for C++ Andrzej Krzemieński<akrzemi1@gmail.com> - 2011-08-02 18:15 -0600

csiph-web