[patch] Preprocessorised tr1::tuple
Douglas Gregor
doug.gregor@gmail.com
Sat Feb 26 13:58:00 GMT 2005
On Feb 25, 2005, at 6:27 PM, Benjamin Kosnik wrote:
>> bind and result_of will also need this preprocessor magic. I think
>> that's it for TR1...
>
> I would rather use something like boost::spirit than write our own bit
> of magic for libstdc++.
>
> Is this what you were implying?
I just realized how unclear my message was... my apologies.
As far as I know, the following components of TR1 require a nontrivial
amount of code repetition that can be implemented with preprocessor
metaprogramming, some kind of C++ code generator, or brute force:
1) tuple
2) reference_wrapper
3) function
4) mem_fn
5) result_of
6) bind
7) (maybe) parts of type traits, but I think we can avoid it
I think pulling in something like the Boost.Preprocessor library would
be overkill for this... a small preprocessor library like Chris has
done or just enumerating the cases as I've done for function and mem_fn
should be sufficient. The only parts of that list that we need to
implement are reference_wrapper, result_of, and bind: the former two
can use the same macros used by function and mem_fn but the latter
might require something more sophisticated.
*Glances upward, sighs* Maybe some day variadic templates will save us
from all this.
Doug
More information about the Libstdc++
mailing list