Tim Day wrote:
Have you considered how boost::tuple might help ? A boost::tuple
would seem to provide most of the above. A simple template could provide a tuple-wrapping class restricting allocation to the shared_ptr--returning construct method. OK so you wouldn't get to name the members, and the construct method itself would presumably need to take a tuple (unless you provide sufficient templated member functions to handle as many arguments as necessary). I don't know how important those aspects are to you though.
Quite important, actually. I suspect using boost tuples in a wrapper would result in the same amount of code as unboosted code, if not more.
In my experience, trying to be too clever with the preprocessor results in a nastier mess than the problem you were originally trying to solve.
Hm. Not really. I've already done some things with the preprocessor that significantly shortened and clarified my code. The only downside for me seems to be that syntax highlighting will not work. -- Michiel Helvensteijn