Opened 9 years ago

Last modified 9 years ago

#9631 new Bugs

function_input_iterator does not work with lambda

Reported by: Piotr Wygocki <wygos@…> Owned by: jeffrey.hellrung
Milestone: To Be Determined Component: iterator
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

The following program does not compile on g++-4.8.1/clang-3.4

1 #define BOOST_RESULT_OF_USE_DECLTYPE 2 #include <boost/iterator/function_input_iterator.hpp> 3 4 int main() { 5 auto f = [](){return 1;}; 6 auto i = boost::make_function_input_iterator(f, 0); 7 return 0; 8 }

error: g++ main.cpp -std=c++0x -I/home/wygos/libs/boost_1_55_0/include/

In file included from main.cpp:2:0: /home/wygos/libs/boost_1_55_0/include/boost/iterator/function_input_iterator.hpp: In instantiation of ‘class boost::impl::function_input_iterator<main()::lambda0, int>’: /home/wygos/libs/boost_1_55_0/include/boost/iterator/function_input_iterator.hpp:112:11: required from ‘class boost::function_input_iterator<main()::lambda0, int>’

main.cpp:6:54: required from here

/home/wygos/libs/boost_1_55_0/include/boost/iterator/function_input_iterator.hpp:26:15: error: no type named ‘result_type’ in ‘struct main()::lambda0’

class function_input_iterator

/home/wygos/libs/boost_1_55_0/include/boost/iterator/function_input_iterator.hpp:48:17: error: no type named ‘result_type’ in ‘struct main()::lambda0’

dereference() const {

/home/wygos/libs/boost_1_55_0/include/boost/iterator/function_input_iterator.hpp:59:62: error: no type named ‘result_type’ in ‘struct main()::lambda0’

mutable optional<typename Function::result_type> value;

Suggested solution:

function_input_iterator should use boost::result_of

Change History (3)

comment:1 by Piotr Wygocki <wygos@…>, 9 years ago

The code was suppressed to one line. I paste it one more time.

#define BOOST_RESULT_OF_USE_DECLTYPE

#include <boost/iterator/function_input_iterator.hpp>

int main() {

auto f = [](){return 1;};

auto i = boost::make_function_input_iterator(f, 0);

return 0;

}

comment:2 by Piotr Wygocki <wygos@…>, 9 years ago

Version: Boost 1.54.0Boost 1.55.0

comment:3 by viboes, 9 years ago

Component: Noneiterator
Owner: set to jeffrey.hellrung
Note: See TracTickets for help on using tickets.