C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

parameter lists in C++

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Chris Finlayson
Guest





PostPosted: Thu Dec 11, 2003 12:06 pm    Post subject: parameter lists in C++ Reply with quote



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





PostPosted: Fri Dec 12, 2003 7:02 pm    Post subject: Re: parameter lists in C++ Reply with quote



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





PostPosted: Sat Dec 13, 2003 2:27 am    Post subject: Re: parameter lists in C++ Reply with quote



"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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.