C++ question for hugin
Kai-Uwe Behrmann
ku.b at gmx.de
Tue Jul 22 16:03:12 BST 2003
Am 22.07.03, 14:41 +0200 schrieb Pablo d'Angelo:
> > Two classes exist: class foo with members int a,b,c and
> > class bar with members double a,b,c .
> > void class_name::func ( char type )
> > {
> > int intern_int;
> > double intern_float;
> >
> > intern_int = foo.type;
> > ...
> > intern_float = bar.type;
> > }
>
> Ok, what you called "type" is the name of a member of the foo and bar
> structs,
> right?
Yes.
> if foo and bar only contains a members of a single type, then you can
> use a
> associative array for that. (std::map and std:multimap are
> implementations of associative array's in the c++ standart library.)
They seem too compilicated for me. I could only map my variable names to
enums and make the request in the code visible through using this enums.
What I need is something like a litterally substitution as done by macros
without blowing up the code.
> Where do you need that functionality?
In hugin we use the variables names in several structures - as variable
with own members, in the xml resources and as part of different classes.
It would be nice to say for yaw, pitch, HFOV ... function do allwas the
same on it, exchange only the names. Load xrc stuff access values...
> > thanks, as well for explaining it is outside C++ or another language
> > can do
>
> Thats not possible with C or C++, they are to static for this.
I was afraid of this.
> Hmm, I think there is a way to archive part of what you want with
> templates. But maybe its easier to find another solution.
>
> ciao
> Pablo
> --
> http://wurm.wohnheim.uni-ulm.de/~redman/
> Please use PGP
>
thanks
Kai-Uwe
More information about the ptX
mailing list