Changes between Initial Version and Version 1 of Ticket #7748


Ignore:
Timestamp:
Sep 10, 2013, 8:35:08 PM (9 years ago)
Author:
viboes
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7748 – Description

    initial v1  
    11Code like the following doesn't work trunk (and released) transformed:
    22
     3
     4{{{
    35std::vector<int> myList(...);
    46float sum = boost::accumulate(myList | transformed([](int a) { return a * 5; }), 0.f);
     7}}}
     8
    59
    610The following patch & test modifications allow the following syntax:
     11
     12{{{
    713float sum = boost::accumulate(myList | transformed<float>([](int a) { return a * 5.f; }), 0.f);
     14}}}
     15
    816
    917This wouldn't be a problem if result_of used or fell back to decltype, but it seems that won't be available for a while.  The proposed syntax could also be helpful when using transformed with functors whose implementations are both unmodifiable and don't follow result_of.