[libstdc++ patch] TR1 reference_wrapper invocation, base classes

Douglas Paul Gregor dgregor@cs.indiana.edu
Wed Mar 2 14:20:00 GMT 2005


I've committed this patch, and the patch it depends on, to mainline and 
the 4.0 branch.

    Doug

Douglas Gregor wrote:

>This patch adds support for reference_wrapper invocation and introduces the 
>right base classes and typedefs for reference_wrapper. It builds on (but does 
>not include) the result_of patch I sent previously 
>(http://gcc.gnu.org/ml/libstdc++/2005-02/msg00250.html) and fixes one bug in 
>that patch: result_of did not do the right thing for member data pointers, 
>but now it does.
>
>The repetition code in tr1/functional that includes tr1/functional_iterate.h 
>many times has been moved into tr1/repeat.h, because it is needed for files 
>other than tr1/functional_iterate.h; you now define a macro 
>(_GLIBCXX_REPEAT_HEADER) and include tr1/repeat.h when you need to repeat 
>code.
>
>There is a _lot_ of metaprogramming in this patch; much more so than I had 
>expected, and that makes the code a little bit hairy. There are two major 
>complicating factors:
>  (1) reference_wrapper<T> derives from unary_function and/or binary_function 
>when possible. This happens when the type T is a free or member function 
>pointer, function type, or class type derived from unary_function and/or 
>binary_function. I've tried to document all of the metaprogramming I had to 
>do to get those right, and included the tricky test cases I could think of. 
>
>  (2) reference_wrapper<T>::operator() has to deal with invoking member 
>pointers (by wrapping in mem_fn), function objects, and function references. 
>There is some SFINAE/enable_if magic in the __invoke function to decide 
>between these options.
>
>There are a few other trivial changes:
>  - Shortened long lines 
>  - Fixed typos and an incorrect e-mail address in some headers/tests
>
>Tested on i686-pc-linux-gnu with no failures. ChangeLog below.
>  
>



More information about the Libstdc++ mailing list