[libstdc++ PATCH] TR1 'function' and 'mem_fn' support

Douglas Gregor dgregor@cs.indiana.edu
Wed Jan 26 07:09:00 GMT 2005


The attached patch adds support for std::tr1::function and std::tr1::mem_fn to 
libstdc++. The good news is that it implements the complete specification and 
passes all of the existing libstdc++ tests (plus the two new tests) on x86 
Linux. The bad news is that it only passes when using my (unreviewed) patch 
for making member pointers work properly with function types, posted here:

 http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01627.html

It is possible to work around the bugs fixed by that patch, but it's very, 
very ugly and will require a lot of new code. As it is, any implementation of 
these facilities requires a huge amount of repetition; in this case, I've 
chosen to repeatedly include a header file, using macros to generate 
different code each time. 

In addition to the patch and changelog, I've attached the two new test cases 
(.cc files). I was unable to find a way to get them into a patch, because 
they should be placed in a directory that does not yet exist 
(libstdc++-v3/testsuite/tr1/3_function_objects, e.g.).

Comments appreciated.

 Douglas Gregor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tr1_function_memfn.patch
Type: text/x-diff
Size: 67538 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20050126/c59670f1/attachment.bin>
-------------- next part --------------
2005-01-26	Douglas Gregor <doug.gregor@gmail.com>

	* include/tr1/functional (function): New class template.
	(mem_fn): New function template.
	Implementations of TR1 function and mem_fn facilities.
	* include/tr1/functional_iterate.h: Implementations of TR1
	function and mem_fn facilities. 
	* testsuite/tr1/3_function_objects/polymorphic_wrapper.cc: New
	test of std::tr1::function.
	* testsuite/tr1/3_function_objects/mem_fn.cc: New test of
	std::tr1::mem_fn. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mem_fn.cc
Type: text/x-c++src
Size: 1977 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20050126/c59670f1/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: polymorphic_wrapper.cc
Type: text/x-c++src
Size: 15673 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20050126/c59670f1/attachment-0002.bin>


More information about the Libstdc++ mailing list