Opened 12 years ago
Last modified 12 years ago
#4569 new Patches
[patch] fusion::unfused reusability / perfect forwarding
Reported by: | anonymous | Owned by: | t_schwinger |
---|---|---|---|
Milestone: | To Be Determined | Component: | fusion |
Version: | Boost 1.44.0 | Severity: | Problem |
Keywords: | Cc: |
Description
attached is a patch to unfused.hpp, used by fusion::make_unfused.
what it does:
- "fused" currently forces you to store a function object in order to use the "unfusing" interface. this patch makes the interface of unfused reusable by other classes, by introducing a CRTP class "unfuse_interface", that is used by unfused.
simplified example:
class unfused : unfused_interface<unfused,...>{ private: friend class unfused_interface; result call(Args &args){ //unfused::operator()(...) was called. args is a sequence //of the passed arguments return stored_fused_functor(args); } Function stored_fused_functor; };
- perfect forwarding:
"unfused" only takes non-const references as arguments. this patch changes that to the compromise of boost::bind(): perfect forwarding for up to 2 arguments, beyond that either all arguments are const refs, or all arguments are non-const refs.
Attachments (1)
Change History (4)
by , 12 years ago
Attachment: | unfused.patch added |
---|
comment:1 by , 12 years ago
Type: | Feature Requests → Patches |
---|
comment:2 by , 12 years ago
comment:3 by , 12 years ago
Owner: | changed from | to
---|
Note:
See TracTickets
for help on using tickets.
the "perfect forwarding" part seems to create more problems than it solves, especially regarding result_of instantiations, so if you consider this patch I'd now recommend leaving out the forwarding part.