Opened 12 years ago

Last modified 8 years ago

#4577 new Bugs

invoke() uses invalid boost::result_of<>

Reported by: anonymous Owned by: t_schwinger
Milestone: To Be Determined Component: fusion
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

struct F{
  template<typename Sig>
  struct result;
};

vector<int> const vec(5);
invoke(F(),vec); // (1)

int t(int i){ return i; }
invoke(F(),transform(vec,&t)); // (2)

(1) uses F::result<F(int const &)>, while (2) uses F::result<F(int)>. I believe it should be (1) in both cases.

attaching test case and patch, which converts each argument type using fusion::detail::call_param

Attachments (2)

test.cpp (519 bytes ) - added by anonymous 12 years ago.
invoke.patch (859 bytes ) - added by anonymous 12 years ago.

Download all attachments as: .zip

Change History (4)

by anonymous, 12 years ago

Attachment: test.cpp added

by anonymous, 12 years ago

Attachment: invoke.patch added

comment:1 by Joel de Guzman, 12 years ago

Owner: changed from Joel de Guzman to t_schwinger

comment:2 by Kohei Takahashi <flast@…>, 8 years ago

I think that original behaviour is eligible in such situation.

In (1), as you know, vec[n] is const lvalue reference of int since vec is const lvalue of vector. However, in (2), the function t returns prvalue of int: means type of f(vec[n]) is just int.

So, I'm against the suggestion.

Note: See TracTickets for help on using tickets.