forwarding-function macro library?

Is there a macro library in Boost for making forwarding functions (the thing that can only be done perfectly in C++0x, with decltype, rvalue references and perhaps parameter packs)? I found myself needing to do that again, as I worked more on my ideas for integer wrapping, and so I started making a macro library for it... I have no idea where I'd look to find if such a thing already existed, beyond reading the summaries of all the Boost libraries. I suppose it would be helpful to have a general library in Boost to do that? (with all the compiler workarounds, the choice of the user which workaround to prefer, etc.) (more generally/irrelevantly, I'm surprised how often Boost libraries share techniques that ought to be libraries in themselves. And how poorly commented some of Boost code is... but there I'm getting way off topic :-P) -Isaac

Isaac Dupree wrote:
(more generally/irrelevantly, I'm surprised how often Boost libraries share techniques that ought to be libraries in themselves. And how poorly commented some of Boost code is... but there I'm getting way off topic :-P)
I agree, and I notice a number of submissions (e.g. fusion, proto) say they were previously a part of Spirit or something. It looks to me as if some of the libraries should be re-reviewed sometimes, because I think the suite of tools available in boost changes and the libraries need to be kept consistent. For instance, as a user, I don't immediately see why there is a need for Boost.Bind _and_ Boost.Lambda. I don't know why a GIL image does not use the concepts from MultiArray (same with uBLAS), and I don't know if 'Tuples' will become irrelevant now that we have Fusion cons/lists (and more powerful algorithms etc.) Also it seems like the 'operators' and the 'iterators' libraries overlap IIRC. I also don't know why we need three different sets of placeholders in mpl, bind, and lambda (perhaps 'cause I don't know implementation details). Frankly, recently I have been experiencing some anxiety over which boost tool to choose because of the almost-but-not-quite repeated stuff. --John

On Sat, Aug 9, 2008 at 6:57 AM, Isaac Dupree <isaacdupree@charter.net> wrote:
Is there a macro library in Boost for making forwarding functions (the thing that can only be done perfectly in C++0x, with decltype, rvalue references and perhaps parameter packs)?
Perhaps the Boost.Functional/Forward library might be helpful to you (not a macro library for forwarding functions, but a more elegant solution for function objects). It was accepted into boost but I'm not sure whether it has made it to trunk yet. Here is the review announcement with links: http://lists.boost.org/boost-announce/2007/12/0149.php Regards, Stjepan

Stjepan Rajko wrote:
On Sat, Aug 9, 2008 at 6:57 AM, Isaac Dupree <isaacdupree@charter.net> wrote:
Is there a macro library in Boost for making forwarding functions (the thing that can only be done perfectly in C++0x, with decltype, rvalue references and perhaps parameter packs)?
Perhaps the Boost.Functional/Forward library might be helpful to you (not a macro library for forwarding functions, but a more elegant solution for function objects). It was accepted into boost but I'm not sure whether it has made it to trunk yet. Here is the review announcement with links:
I see.. Only *declaring* the many-overloads once, might be helpful to the compiler (although there wasn't evidence presented either way -- just that the *preprocessing* wasn't the main overhead on most compilers). For fixed-number-of-argument forwarding, it's rather less efficient. I just wish one could do "using some_class::static_function" at namespace scope... Another issue about I ran into perfect forwarding: about C++0x's "constexpr". I was having trouble figuring out for sure... but it looked like it doesn't like const-reference or templated rvalue-reference arguments for constexpr function types. Which would mean that there's no perfect forwarding in the presence of constexpr (a constexpr function with all non-reference arguments would be the only way). (Did I miss something? Is it worth installing ConceptGCC to see if I can play around with it (on linux))? -Isaac
participants (3)
-
Isaac Dupree
-
John C. Femiani
-
Stjepan Rajko