 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Chris Finlayson Guest
|
Posted: Thu Dec 11, 2003 12:06 pm Post subject: parameter lists in C++ |
|
|
Hi all,
I was wondering if there's an existing library out there that supports
something along the lines of Java's ParameterList concept (look for it
in the list of classes at
[url]http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/index.html)[/url].
The goal is as follows:
1. Have a class define inside of it parameters it needs, default
values, ranges, and validation. These parameters may be of different
types.
2. When a person instantiates an object of this class, inquire about
its list of needed parameters, and fill them where appropriate.
Thanks!
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
v Guest
|
Posted: Fri Dec 12, 2003 7:02 pm Post subject: Re: parameter lists in C++ |
|
|
Hi,
| Quote: | 1. Have a class define inside of it parameters it needs, default
values, ranges, and validation. These parameters may be of different
types.
|
take a look at std::map for a container type which may fit Your needs and
take a look at boost::any at www.boot.org for a generic, yet type safe
wrapper.
| Quote: | 2. When a person instantiates an object of this class, inquire about
its list of needed parameters, and fill them where appropriate.
|
You mean at runtime, well this requires a sort of reflextion (in
java-speak),
which is not directly supported by c++. but you can as a class always return
a list of parameters required, this again would make the class user rather
complicated.
bye
vl
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
David Abrahams Guest
|
Posted: Sat Dec 13, 2003 2:27 am Post subject: Re: parameter lists in C++ |
|
|
"v" <_qquench_at_compuserve_dot_de_ (AT) news (DOT) arcor-ip.de> writes:
| Quote: | Hi,
1. Have a class define inside of it parameters it needs, default
values, ranges, and validation. These parameters may be of different
types.
take a look at std::map for a container type which may fit Your needs and
take a look at boost::any at www.boot.org for a generic, yet type safe
wrapper.
|
In the sandbox we have some code and tests for Python-style named
parameter lists:
f(33, acceleration = 9.8, name = "jumper")
source: http://tinyurl.com/yzj0
test: http://tinyurl.com/yzix
No docs yet, sorry. I hope you can understand it by looking at the
test code.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|