Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#6728 closed Feature Requests (fixed)

function_property_map

Reported by: philipp.moeller@… Owned by: Jeremiah Willcock
Milestone: Boost 1.50.0 Component: property_map
Version: Boost 1.49.0 Severity: Cosmetic
Keywords: property_map Cc:

Description

A missing component in the property_maps library is an adapter for functions to property_maps.

A working implementation under the Boost License can be found here: https://github.com/bo0ts/property_map_extensions/blob/master/function_property_map.hpp

Features: type deduction when available, C++03 compatible, Problems: hacky way of specifying if either std::result_of or boost:result_of is to be used (boost::result_of does not work with lambdas)

It would still require some testing. The required documentation should be minimal.

Attachments (2)

function_property_map.hpp (2.0 KB ) - added by Jeremiah Willcock 11 years ago.
function_property_map_test.cpp (2.1 KB ) - added by Jeremiah Willcock 11 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by philipp.moeller@…, 11 years ago

Component: Noneproperty_map
Owner: set to Douglas Gregor

comment:2 by Jeremiah Willcock, 11 years ago

Owner: changed from Douglas Gregor to Jeremiah Willcock
Status: newassigned

comment:3 by Jeremiah Willcock, 11 years ago

Please check the code and test I'm about to attach. I changed to boost::result_of; any bugs in it regarding lambdas are its maintainer's problem and should be fixed there. I also removed the perfect forwarding code because it was broken (see add1 and the uses of it in the test code).

by Jeremiah Willcock, 11 years ago

Attachment: function_property_map.hpp added

by Jeremiah Willcock, 11 years ago

comment:4 by philipp.moeller@…, 11 years ago

Thanks for fixing those problems.

boost::result_of is unlikely to use the native decltype facilities for some time. This is due to an non-conforming decltype implementation in some compilers and the breakage that enabling this feature caused in Boost. Your version will not be usable with lambdas until this is fixed, but if you deem this acceptable over my hacks to get it working that is alright.

comment:5 by Jeremiah Willcock, 11 years ago

I am annoyed by the boost::result_of bug too; I use BOOST_RESULT_OF_USE_DECLTYPE to work around the bug when I use C++11 (there are enough parts of Boost that use result_of that I can't avoid it).

comment:6 by philipp.moeller@…, 11 years ago

But this gets unmanageable and reincluding is not possible thanks to the include guards. I guess there is nothing we can do here without making it a hack. I suggest to leave it the way it is and have users manage BOOST_RESULT_OF_USE_DECLTYPE themselves. The issue can be closed as far as I'm concerned.

comment:7 by Jeremiah Willcock, 11 years ago

Resolution: fixed
Status: assignedclosed

(In [77506]) Added function_property_map based on code from Philipp Moeller; fixes #6728

comment:8 by Michel Morin <mimomorin@…>, 11 years ago

I'll make some proposal about decltype-based boost::result_of on devel ML.

Note: See TracTickets for help on using tickets.