Click here to Skip to main content
15,908,768 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dynamically creating variable length argument list Pin
Kentamanos21-Oct-03 13:19
Kentamanos21-Oct-03 13:19 
GeneralRe: Dynamically creating variable length argument list Pin
WREY21-Oct-03 14:23
WREY21-Oct-03 14:23 
GeneralRe: Dynamically creating variable length argument list Pin
Kentamanos22-Oct-03 6:41
Kentamanos22-Oct-03 6:41 
GeneralRe: Dynamically creating variable length argument list Pin
John R. Shaw21-Oct-03 15:21
John R. Shaw21-Oct-03 15:21 
GeneralC++ Question. Pin
WREY21-Oct-03 9:41
WREY21-Oct-03 9:41 
GeneralRe: C++ Question. Pin
David Crow21-Oct-03 9:46
David Crow21-Oct-03 9:46 
GeneralRe: C++ Question. Pin
WREY21-Oct-03 10:30
WREY21-Oct-03 10:30 
GeneralRe: C++ Question. Pin
Andrew Walker21-Oct-03 14:05
Andrew Walker21-Oct-03 14:05 
Templates, boost and STL can provide a type safe solution, but it still isn't perfect.

std::vector< boost::any >

may be what you're looking for. Boost::any uses three classes.
1/ Wrapper class, which stores a pointer to a 2
2/ Abstract implementation class
3/ Concrete template class which extends 2

You still need to use any_cast to retrieve your data, but it effectively only a static_cast, much better than using void*'s

It's worth looking into the theory behind boost::any because you may be able to avoid the use of the any_cast / static_cast if you roll your own with careful modifications to all of the classes.

I've spent a fair bit of time looking at exactly this type of problem and come up with no really satisfying solution. My context was with regards to data pipelining arbitrary data types between 'transforms'. I was trying to provide a generic system easy to use by the less experienced. The real problem when I dug down further was that relationships between our classes (cohesion / coupling) were causing delays in development because of long compile times. My advice? Consider your requirements very carefully - Why are you trying to write this code? What other tools or alternatives do you have - since then we've started looking at weakly typed scripting for rapid development.


If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.

Rudyard Kipling

GeneralRe: C++ Question. Pin
John R. Shaw21-Oct-03 15:55
John R. Shaw21-Oct-03 15:55 
GeneralRe: C++ Question. Pin
WREY21-Oct-03 23:35
WREY21-Oct-03 23:35 
GeneralSpecified the path with Cfiledialog Pin
sdfdsfa21-Oct-03 8:37
sdfdsfa21-Oct-03 8:37 
GeneralRe: Specified the path with Cfiledialog Pin
David Crow21-Oct-03 9:44
David Crow21-Oct-03 9:44 
GeneralRe: Specified the path with Cfiledialog Pin
Anonymous21-Oct-03 18:33
Anonymous21-Oct-03 18:33 
GeneralSerialization Pin
swerajan21-Oct-03 8:25
swerajan21-Oct-03 8:25 
GeneralRe: Serialization Pin
David Crow21-Oct-03 9:43
David Crow21-Oct-03 9:43 
GeneralRe: Serialization Pin
John R. Shaw21-Oct-03 16:15
John R. Shaw21-Oct-03 16:15 
Generaloleacc horror Pin
Mukkie21-Oct-03 8:24
Mukkie21-Oct-03 8:24 
GeneralRe: oleacc horror Pin
PJ Arends21-Oct-03 10:19
professionalPJ Arends21-Oct-03 10:19 
GeneralRe: oleacc horror Pin
Mukkie21-Oct-03 11:01
Mukkie21-Oct-03 11:01 
GeneralRe: oleacc horror Pin
igor196021-Oct-03 11:27
igor196021-Oct-03 11:27 
GeneralLNK2001 error Pin
jimNLX21-Oct-03 7:27
jimNLX21-Oct-03 7:27 
GeneralRe: LNK2001 error Pin
Chris Meech21-Oct-03 7:59
Chris Meech21-Oct-03 7:59 
GeneralDisappearing list controls Pin
JT Anderson21-Oct-03 6:14
JT Anderson21-Oct-03 6:14 
GeneralRe: Disappearing list controls Pin
igor196021-Oct-03 8:51
igor196021-Oct-03 8:51 
GeneralRe: Disappearing list controls Pin
JT Anderson21-Oct-03 9:17
JT Anderson21-Oct-03 9:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.