Catkin build fails when a lambda is added to it - c++

rand_dat1_sub_handle = node.subscribe<geometry_msgs::Vector3>(
"random/data1", 100,
[](geometry_msgs::Vector3::ConstPtr& data){std::cout<<data->x;});
rand_dat2_sub_handle = node.subscribe<geometry_msgs::Vector3>(
"random/data2", 100,
[](geometry_msgs::Vector3::ConstPtr& data){std::cout<<data->x;});
when I use the above block of code in my class definition script, my build fails giving me the following errors.
In file included from /usr/include/boost/function/detail/maybe_include.hpp:18:0,
from /usr/include/boost/function/detail/function_iterate.hpp:14,
from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52,
from /usr/include/boost/function.hpp:64,
from /opt/ros/melodic/include/ros/forwards.h:40,
from /opt/ros/melodic/include/ros/common.h:37,
from /opt/ros/melodic/include/ros/ros.h:43,
from /home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.h:7,
from /home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:2:
/usr/include/boost/function/function_template.hpp: In instantiation of ‘static void boost::detail::function::void_function_obj_invoker1<FunctionObj, R, T0>::invoke(boost::detail::function::function_buffer&, T0) [with FunctionObj = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&]’:
/usr/include/boost/function/function_template.hpp:925:38: required from ‘void boost::function1<R, T1>::assign_to(Functor) [with Functor = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&]’
/usr/include/boost/function/function_template.hpp:716:7: required from ‘boost::function1<R, T1>::function1(Functor, typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type) [with Functor = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&; typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type = int]’
/usr/include/boost/function/function_template.hpp:1061:16: required from ‘boost::function<R(T0)>::function(Functor, typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type) [with Functor = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&; typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type = int]’
/home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:85:83: required from here
/usr/include/boost/function/function_template.hpp:159:11: error: no match for call to ‘(TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>) (const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&)’
BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS));
^
/usr/include/boost/function/function_template.hpp:159:11: note: candidate: void (*)(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&) {aka void (*)(boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&)} <conversion>
/usr/include/boost/function/function_template.hpp:159:11: note: conversion of argument 2 would be ill-formed:
/usr/include/boost/function/function_template.hpp:159:11: error: binding reference of type ‘geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr& {aka boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&}’ to ‘const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >’ discards qualifiers
/home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:85:50: note: candidate: TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)> <near match>
[](geometry_msgs::Vector3::ConstPtr& data){std::cout<<data->x<<std::endl;});
^
/home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:85:50: note: conversion of argument 1 would be ill-formed:
In file included from /usr/include/boost/function/detail/maybe_include.hpp:18:0,
from /usr/include/boost/function/detail/function_iterate.hpp:14,
from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52,
from /usr/include/boost/function.hpp:64,
from /opt/ros/melodic/include/ros/forwards.h:40,
from /opt/ros/melodic/include/ros/common.h:37,
from /opt/ros/melodic/include/ros/ros.h:43,
from /home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.h:7,
from /home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:2:
/usr/include/boost/function/function_template.hpp:159:11: error: binding reference of type ‘geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr& {aka boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&}’ to ‘const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >’ discards qualifiers
BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS));
^
/usr/include/boost/function/function_template.hpp: In instantiation of ‘static void boost::detail::function::void_function_obj_invoker1<FunctionObj, R, T0>::invoke(boost::detail::function::function_buffer&, T0) [with FunctionObj = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&]’:
/usr/include/boost/function/function_template.hpp:925:38: required from ‘void boost::function1<R, T1>::assign_to(Functor) [with Functor = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&]’
/usr/include/boost/function/function_template.hpp:716:7: required from ‘boost::function1<R, T1>::function1(Functor, typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type) [with Functor = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&; typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type = int]’
/usr/include/boost/function/function_template.hpp:1061:16: required from ‘boost::function<R(T0)>::function(Functor, typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type) [with Functor = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&; typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type = int]’
/home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:89:83: required from here
/usr/include/boost/function/function_template.hpp:159:11: error: no match for call to ‘(TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>) (const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&)’
/usr/include/boost/function/function_template.hpp:159:11: note: candidate: void (*)(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&) {aka void (*)(boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&)} <conversion>
/usr/include/boost/function/function_template.hpp:159:11: note: conversion of argument 2 would be ill-formed:
/usr/include/boost/function/function_template.hpp:159:11: error: binding reference of type ‘geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr& {aka boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&}’ to ‘const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >’ discards qualifiers
/home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:89:50: note: candidate: TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)> <near match>
[](geometry_msgs::Vector3::ConstPtr& data){std::cout<<data->x<<std::endl;});
^
/home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:89:50: note: conversion of argument 1 would be ill-formed:
In file included from /usr/include/boost/function/detail/maybe_include.hpp:18:0,
from /usr/include/boost/function/detail/function_iterate.hpp:14,
from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52,
from /usr/include/boost/function.hpp:64,
from /opt/ros/melodic/include/ros/forwards.h:40,
from /opt/ros/melodic/include/ros/common.h:37,
from /opt/ros/melodic/include/ros/ros.h:43,
from /home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.h:7,
from /home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:2:
/usr/include/boost/function/function_template.hpp:159:11: error: binding reference of type ‘geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr& {aka boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&}’ to ‘const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >’ discards qualifiers
BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS));
^
gui_pkg/CMakeFiles/TCPSERVER.dir/build.make:62: recipe for target 'gui_pkg/CMakeFiles/TCPSERVER.dir/src/tcpserver.cpp.o' failed
make[2]: *** [gui_pkg/CMakeFiles/TCPSERVER.dir/src/tcpserver.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:1735: recipe for target 'gui_pkg/CMakeFiles/TCPSERVER.dir/all' failed
make[1]: *** [gui_pkg/CMakeFiles/TCPSERVER.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
when i used the regular function callback as shown below, it works fine
rand_dat1_sub_handle = node.subscribe<geometry_msgs::Vector3>(
"random/data1", 100,
&TCPServer::update_data1, this);
How do I use lamdas properly to represent callbacks in subscriber nodes?
I've edited the question showing the new errors after switching from geometry_msgs::Vector3Ptr& to geometry_msgs::Vector3::ConstPtr&.

Related

error: no matching function for call to ‘std::thread::_Invoker<std::tuple

I'm facing a thread problem.
I tried to execute function inside a thread from Chronometer class including a while loop:
Here is the part code:
for(int i = 0; i<car_data.size();i++)
{
if(car_data[i]->checkArea(frame, pt1_zone, pt2_zone))
{
std::thread(&Chronometer::start_chrono, car_crono[i], std::ref(chrono));
cv::rectangle(frame, car_data[i]->pt1, car_data[i]->pt2, cv::Scalar(255,0,0), 1, cv::LINE_8,0);
//cv::putText(frame, "Parked", car_data[i]->pt1, cv::FONT_HERSHEY_DUPLEX, 0.9, cv::Scalar( 50, 255, 50 ));
//occupancy_state = place.occupancyTrue();
//place_1.occupancy = true;
The type of car_crono and chrono
std::vector<Chronometer*> car_crono;
Chronometer chrono;
Here is my class Chronometer:
class Chronometer
{
private:
static int hour, min, sec;
//std::stringstream ss;
//Chronometer chrono;
public:
Chronometer();
static Chronometer& start_chrono(Chronometer& chrono);
static Chronometer& finish_chrono(Chronometer& chrono);
friend std::ostream& operator<<(std::ostream& flux, Chronometer t);
Chronometer& operator=(const Chronometer& other);
~Chronometer();
};
For the thread I tried several kind of parameters. The last one:
std::thread(&Chronometer::start_chrono, car_crono[i], std::ref(chrono));
I guessed a ref was necessary but doesn't change.
Here is the full error
/usr/include/c++/7/thread: In instantiation of ‘struct std::thread::_Invoker<std::tuple<Chronometer& (*)(Chronometer&), Chronometer*, std::reference_wrapper<Chronometer> > >’:
/usr/include/c++/7/thread:127:22: required from ‘std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = Chronometer& (*)(Chronometer&); _Args = {Chronometer*&, std::reference_wrapper<Chronometer>}]’
recognizer_rtsp.cxx:348:76: required from here
/usr/include/c++/7/thread:240:2: error: no matching function for call to ‘std::thread::_Invoker<std::tuple<Chronometer& (*)(Chronometer&), Chronometer*, std::reference_wrapper<Chronometer> > >::_M_invoke(std::thread::_Invoker<std::tuple<Chronometer& (*)(Chronometer&), Chronometer*, std::reference_wrapper<Chronometer> > >::_Indices)’
operator()()
^~~~~~~~
/usr/include/c++/7/thread:231:4: note: candidate: template<long unsigned int ..._Ind> decltype (std::__invoke((_S_declval<_Ind>)()...)) std::thread::_Invoker<_Tuple>::_M_invoke(std::_Index_tuple<_Ind ...>) [with long unsigned int ..._Ind = {_Ind ...}; _Tuple = std::tuple<Chronometer& (*)(Chronometer&), Chronometer*, std::reference_wrapper<Chronometer> >]
_M_invoke(_Index_tuple<_Ind...>)
^~~~~~~~~
/usr/include/c++/7/thread:231:4: note: template argument deduction/substitution failed:
/usr/include/c++/7/thread: In substitution of ‘template<long unsigned int ..._Ind> decltype (std::__invoke(_S_declval<_Ind>()...)) std::thread::_Invoker<std::tuple<Chronometer& (*)(Chronometer&), Chronometer*, std::reference_wrapper<Chronometer> > >::_M_invoke<_Ind ...>(std::_Index_tuple<_Ind1 ...>) [with long unsigned int ..._Ind = {0, 1, 2}]’:
/usr/include/c++/7/thread:240:2: required from ‘struct std::thread::_Invoker<std::tuple<Chronometer& (*)(Chronometer&), Chronometer*, std::reference_wrapper<Chronometer> > >’
/usr/include/c++/7/thread:127:22: required from ‘std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = Chronometer& (*)(Chronometer&); _Args = {Chronometer*&, std::reference_wrapper<Chronometer>}]’
recognizer_rtsp.cxx:348:76: required from here
/usr/include/c++/7/thread:233:29: error: no matching function for call to ‘__invoke(std::__tuple_element_t<0, std::tuple<Chronometer& (*)(Chronometer&), Chronometer*, std::reference_wrapper<Chronometer> > >, std::__tuple_element_t<1, std::tuple<Chronometer& (*)(Chronometer&), Chronometer*, std::reference_wrapper<Chronometer> > >, std::__tuple_element_t<2, std::tuple<Chronometer& (*)(Chronometer&), Chronometer*, std::reference_wrapper<Chronometer> > >)’
-> decltype(std::__invoke(_S_declval<_Ind>()...))
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/tuple:41:0,
from /usr/include/c++/7/bits/stl_map.h:63,
from /usr/include/c++/7/map:61,
from ../alpr_utils.h:7,
from recognizer_rtsp.cxx:34:
/usr/include/c++/7/bits/invoke.h:89:5: note: candidate: template<class _Callable, class ... _Args> constexpr typename std::__invoke_result<_Functor, _ArgTypes>::type std::__invoke(_Callable&&, _Args&& ...)
__invoke(_Callable&& __fn, _Args&&... __args)
^~~~~~~~
/usr/include/c++/7/bits/invoke.h:89:5: note: template argument deduction/substitution failed:
/usr/include/c++/7/bits/invoke.h: In substitution of ‘template<class _Callable, class ... _Args> constexpr typename std::__invoke_result<_Functor, _ArgTypes>::type std::__invoke(_Callable&&, _Args&& ...) [with _Callable = Chronometer& (*)(Chronometer&); _Args = {Chronometer*, std::reference_wrapper<Chronometer>}]’:
/usr/include/c++/7/thread:233:29: required by substitution of ‘template<long unsigned int ..._Ind> decltype (std::__invoke(_S_declval<_Ind>()...)) std::thread::_Invoker<std::tuple<Chronometer& (*)(Chronometer&), Chronometer*, std::reference_wrapper<Chronometer> > >::_M_invoke<_Ind ...>(std::_Index_tuple<_Ind1 ...>) [with long unsigned int ..._Ind = {0, 1, 2}]’
/usr/include/c++/7/thread:240:2: required from ‘struct std::thread::_Invoker<std::tuple<Chronometer& (*)(Chronometer&), Chronometer*, std::reference_wrapper<Chronometer> > >’
/usr/include/c++/7/thread:127:22: required from ‘std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = Chronometer& (*)(Chronometer&); _Args = {Chronometer*&, std::reference_wrapper<Chronometer>}]’
recognizer_rtsp.cxx:348:76: required from here
/usr/include/c++/7/bits/invoke.h:89:5: error: no type named ‘type’ in ‘struct std::__invoke_result<Chronometer& (*)(Chronometer&), Chronometer*, std::reference_wrapper<Chronometer> >’
What kind of parameter should I pass through the thread ?
I went to several links to find a solution but nothing could solve my problem:
std::thread pass by reference calls copy constructor
No matching function to invoke, using std::thread
...
Chronometer::start_chrono is a static function, so it's not bound to any object, i.e doesn't need an object to called upon.
Static member functions are not associated with any object. When called, they have no this pointer.
You should have simply written.
std::thread(&Chronometer::start_chrono, std::ref(chrono));

"'boost::bind' is ambiguous" C++ error

I'm trying to control an arduino from a c++ program, after some research I found this, but the problem is, it does not compile on eclipse.
It gives me 2 errors at line 102 in 3_async>AsyncSerial.cpp
boost::thread t(boost::bind(&asio::io_service::run, &pimpl->io));
Screenshot
If compiled by using its own CMakeLists.txt it gives no errors.
Any way to know what settings am I missing on eclipse if there are any?
EDIT:
as suggested I'm posting the logs:
12:32:18 **** Incremental Build of configuration Debug for project Arduino_SerialTest ****
make all
Building file: ../src/lib/pica_protocol/Receiver.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -std=c++11 -MMD -MP -MF"src/lib/pica_protocol/Receiver.d" -MT"src/lib/pica_protocol/Receiver.o" -o "src/lib/pica_protocol/Receiver.o" "../src/lib/pica_protocol/Receiver.cpp"
In file included from /usr/include/boost/thread/thread_only.hpp:22:0,
from /usr/include/boost/thread/thread.hpp:12,
from /usr/include/boost/thread.hpp:13,
from ../src/lib/pica_protocol/../serial/AsyncSerial.h:14,
from ../src/lib/pica_protocol/../serial/BufferedAsyncSerial.h:8,
from ../src/lib/pica_protocol/Receiver.h:12,
from ../src/lib/pica_protocol/Receiver.cpp:8:
/usr/include/boost/thread/detail/thread.hpp: In instantiation of ‘void boost::detail::thread_data<F>::run() [with F = void (pica_protocol::Receiver::*)()]’:
../src/lib/pica_protocol/Receiver.cpp:75:1: required from here
/usr/include/boost/thread/detail/thread.hpp:117:17: error: must use ‘.*’ or ‘->*’ to call pointer-to-member function in ‘((boost::detail::thread_data<void (pica_protocol::Receiver::*)()>*)this)->boost::detail::thread_data<void (pica_protocol::Receiver::*)()>::f (...)’, e.g. ‘(... ->* ((boost::detail::thread_data<void (pica_protocol::Receiver::*)()>*)this)->boost::detail::thread_data<void (pica_protocol::Receiver::*)()>::f) (...)’
f();
^
In file included from /usr/include/boost/bind.hpp:22:0,
from ../src/lib/pica_protocol/../serial/AsyncSerial.h:13,
from ../src/lib/pica_protocol/../serial/BufferedAsyncSerial.h:8,
from ../src/lib/pica_protocol/Receiver.h:12,
from ../src/lib/pica_protocol/Receiver.cpp:8:
/usr/include/boost/bind/bind.hpp: In instantiation of ‘void boost::_bi::list2<A1, A2>::operator()(boost::_bi::type<void>, F&, A&, int) [with F = boost::_mfi::mf1<void, pica_protocol::Receiver, std::basic_string<char> >; A = boost::_bi::list0; A1 = boost::_bi::value<pica_protocol::Receiver*>; A2 = boost::_bi::value<std::basic_string<char>*>]’:
/usr/include/boost/bind/bind_template.hpp:20:59: required from ‘boost::_bi::bind_t<R, F, L>::result_type boost::_bi::bind_t<R, F, L>::operator()() [with R = void; F = boost::_mfi::mf1<void, pica_protocol::Receiver, std::basic_string<char> >; L = boost::_bi::list2<boost::_bi::value<pica_protocol::Receiver*>, boost::_bi::value<std::basic_string<char>*> >; boost::_bi::bind_t<R, F, L>::result_type = void]’
/usr/include/boost/thread/detail/thread.hpp:117:17: required from ‘void boost::detail::thread_data<F>::run() [with F = boost::_bi::bind_t<void, boost::_mfi::mf1<void, pica_protocol::Receiver, std::basic_string<char> >, boost::_bi::list2<boost::_bi::value<pica_protocol::Receiver*>, boost::_bi::value<std::basic_string<char>*> > >]’
../src/lib/pica_protocol/Receiver.cpp:75:1: required from here
/usr/include/boost/bind/bind.hpp:313:34: error: no match for call to ‘(boost::_mfi::mf1<void, pica_protocol::Receiver, std::basic_string<char> >) (pica_protocol::Receiver*&, std::basic_string<char>*&)’
unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
^
In file included from /usr/include/boost/mem_fn.hpp:22:0,
from /usr/include/boost/bind/bind.hpp:26,
from /usr/include/boost/bind.hpp:22,
from ../src/lib/pica_protocol/../serial/AsyncSerial.h:13,
from ../src/lib/pica_protocol/../serial/BufferedAsyncSerial.h:8,
from ../src/lib/pica_protocol/Receiver.h:12,
from ../src/lib/pica_protocol/Receiver.cpp:8:
/usr/include/boost/bind/mem_fn_template.hpp:136:65: note: candidates are:
template<class R, class T, class A1 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf1)
^
In file included from /usr/include/boost/bind/mem_fn.hpp:215:0,
from /usr/include/boost/mem_fn.hpp:22,
from /usr/include/boost/bind/bind.hpp:26,
from /usr/include/boost/bind.hpp:22,
from ../src/lib/pica_protocol/../serial/AsyncSerial.h:13,
from ../src/lib/pica_protocol/../serial/BufferedAsyncSerial.h:8,
from ../src/lib/pica_protocol/Receiver.h:12,
from ../src/lib/pica_protocol/Receiver.cpp:8:
/usr/include/boost/bind/mem_fn_template.hpp:163:7: note: R boost::_mfi::mf1<R, T, A1>::operator()(T*, A1) const [with R = void; T = pica_protocol::Receiver; A1 = std::basic_string<char>]
R operator()(T * p, A1 a1) const
^
/usr/include/boost/bind/mem_fn_template.hpp:163:7: note: no known conversion for argument 2 from ‘std::basic_string<char>*’ to ‘std::basic_string<char>’
/usr/include/boost/bind/mem_fn_template.hpp:168:25: note: template<class U> R boost::_mfi::mf1<R, T, A1>::operator()(U&, A1) const [with U = U; R = void; T = pica_protocol::Receiver; A1 = std::basic_string<char>]
template<class U> R operator()(U & u, A1 a1) const
^
/usr/include/boost/bind/mem_fn_template.hpp:168:25: note: template argument deduction/substitution failed:
In file included from /usr/include/boost/bind.hpp:22:0,
from ../src/lib/pica_protocol/../serial/AsyncSerial.h:13,
from ../src/lib/pica_protocol/../serial/BufferedAsyncSerial.h:8,
from ../src/lib/pica_protocol/Receiver.h:12,
from ../src/lib/pica_protocol/Receiver.cpp:8:
/usr/include/boost/bind/bind.hpp:313:34: note: cannot convert ‘(& a)->boost::_bi::list0::operator[]<std::basic_string<char>*>((* &((boost::_bi::list2<boost::_bi::value<pica_protocol::Receiver*>, boost::_bi::value<std::basic_string<char>*> >*)this)->boost::_bi::list2<boost::_bi::value<pica_protocol::Receiver*>, boost::_bi::value<std::basic_string<char>*> >::<anonymous>.boost::_bi::storage2<boost::_bi::value<pica_protocol::Receiver*>, boost::_bi::value<std::basic_string<char>*> >::a2_))’ (type ‘std::basic_string<char>*’) to type ‘std::basic_string<char>’
unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
^
In file included from /usr/include/boost/bind/mem_fn.hpp:215:0,
from /usr/include/boost/mem_fn.hpp:22,
from /usr/include/boost/bind/bind.hpp:26,
from /usr/include/boost/bind.hpp:22,
from ../src/lib/pica_protocol/../serial/AsyncSerial.h:13,
from ../src/lib/pica_protocol/../serial/BufferedAsyncSerial.h:8,
from ../src/lib/pica_protocol/Receiver.h:12,
from ../src/lib/pica_protocol/Receiver.cpp:8:
/usr/include/boost/bind/mem_fn_template.hpp:176:25: note: template<class U> R boost::_mfi::mf1<R, T, A1>::operator()(const U&, A1) const [with U = U; R = void; T = pica_protocol::Receiver; A1 = std::basic_string<char>]
template<class U> R operator()(U const & u, A1 a1) const
^
/usr/include/boost/bind/mem_fn_template.hpp:176:25: note: template argument deduction/substitution failed:
In file included from /usr/include/boost/bind.hpp:22:0,
from ../src/lib/pica_protocol/../serial/AsyncSerial.h:13,
from ../src/lib/pica_protocol/../serial/BufferedAsyncSerial.h:8,
from ../src/lib/pica_protocol/Receiver.h:12,
from ../src/lib/pica_protocol/Receiver.cpp:8:
/usr/include/boost/bind/bind.hpp:313:34: note: cannot convert ‘(& a)->boost::_bi::list0::operator[]<std::basic_string<char>*>((* &((boost::_bi::list2<boost::_bi::value<pica_protocol::Receiver*>, boost::_bi::value<std::basic_string<char>*> >*)this)->boost::_bi::list2<boost::_bi::value<pica_protocol::Receiver*>, boost::_bi::value<std::basic_string<char>*> >::<anonymous>.boost::_bi::storage2<boost::_bi::value<pica_protocol::Receiver*>, boost::_bi::value<std::basic_string<char>*> >::a2_))’ (type ‘std::basic_string<char>*’) to type ‘std::basic_string<char>’
unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
^
In file included from /usr/include/boost/bind/mem_fn.hpp:215:0,
from /usr/include/boost/mem_fn.hpp:22,
from /usr/include/boost/bind/bind.hpp:26,
from /usr/include/boost/bind.hpp:22,
from ../src/lib/pica_protocol/../serial/AsyncSerial.h:13,
from ../src/lib/pica_protocol/../serial/BufferedAsyncSerial.h:8,
from ../src/lib/pica_protocol/Receiver.h:12,
from ../src/lib/pica_protocol/Receiver.cpp:8:
/usr/include/boost/bind/mem_fn_template.hpp:184:7: note: R boost::_mfi::mf1<R, T, A1>::operator()(T&, A1) const [with R = void; T = pica_protocol::Receiver; A1 = std::basic_string<char>]
R operator()(T & t, A1 a1) const
^
/usr/include/boost/bind/mem_fn_template.hpp:184:7: note: no known conversion for argument 1 from ‘pica_protocol::Receiver*’ to ‘pica_protocol::Receiver&’
make: *** [src/lib/pica_protocol/Receiver.o] Errore 1
12:32:20 Build Finished (took 2s.670ms)
EDIT 2:
ok I fixed the ambiguity error by casting the io_service::run like that:
boost::thread t(boost::bind(static_cast<std::size_t(asio::io_service::*)(void)>(&asio::io_service::run), &pimpl->io));
but the compiler error remains, hope someone knows how to fix that ...

gtkmm compiler error when connecting signal

I'm working on an application with a GUI and I'm having trouble when trying to emit a signal (sig_showList, from View) at the connect for another signal (signal_changed, from Gtk::ComboBox), I'd really appreciate your help. The code looks something like this:
"view.h"
class View{
private:
Gtk::ComboBox* combo;
sigc::signal<void,int> sig_showList;
public:
View();
...
};
"view.c"
#include "view.h"
View::View(Glib::RefPtr<Gtk::Builder>& builder){
builder -> get_widget("combo",combo);
combo->signal_changed().connect(sigc::mem_fun(&sig_showList,&sigc::signal<void,int>::emit));
...
}
I compile it with g++ -std=c++98 *.cpp -o out $(pkg-config gtkmm-3.0 --cflags --libs). The error I'm getting is:
In file included from /usr/include/sigc++-2.0/sigc++/functors/slot.h:7:0,
from /usr/include/sigc++-2.0/sigc++/signal_base.h:29,
from /usr/include/sigc++-2.0/sigc++/signal.h:8,
from /usr/include/sigc++-2.0/sigc++/sigc++.h:80,
from /usr/include/glibmm-2.4/glibmm/thread.h:58,
from /usr/include/glibmm-2.4/glibmm.h:87,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from vista.cpp:2:
/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h: In instantiation of ‘sigc::adaptor_functor<T_functor>::result_type sigc::adaptor_functor<T_functor>::operator()() const [with T_functor = sigc::bound_const_mem_functor1<void, sigc::signal<void, int>, const int&>; sigc::adaptor_functor<T_functor>::result_type = void]’:
/usr/include/sigc++-2.0/sigc++/functors/slot.h:103:36: required from ‘static T_return sigc::internal::slot_call0<T_functor, T_return>::call_it(sigc::internal::slot_rep*) [with T_functor = sigc::bound_const_mem_functor1<void, sigc::signal<void, int>, const int&>; T_return = void]’
/usr/include/sigc++-2.0/sigc++/functors/slot.h:110:37: required from ‘static void* (* sigc::internal::slot_call0<T_functor, T_return>::address())(void*) [with T_functor = sigc::bound_const_mem_functor1<void, sigc::signal<void, int>, const int&>; T_return = void; sigc::internal::hook = void* (*)(void*)]’
/usr/include/sigc++-2.0/sigc++/functors/slot.h:454:83: required from ‘sigc::slot0<T_return>::slot0(const T_functor&) [with T_functor = sigc::bound_const_mem_functor1<void, sigc::signal<void, int>, const int&>; T_return = void]’
/usr/include/sigc++-2.0/sigc++/functors/slot.h:1130:26: required from ‘sigc::slot<T_return, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::slot(const T_functor&) [with T_functor = sigc::bound_const_mem_functor1<void, sigc::signal<void, int>, const int&>; T_return = void]’
vista.cpp:80:105: required from here
/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:251:21: error: no match for call to ‘(sigc::bound_const_mem_functor1<void, sigc::signal<void, int>, const int&>) ()’
{ return functor_(); }
^
In file included from /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:9:0,
from /usr/include/sigc++-2.0/sigc++/functors/slot.h:7,
from /usr/include/sigc++-2.0/sigc++/signal_base.h:29,
from /usr/include/sigc++-2.0/sigc++/signal.h:8,
from /usr/include/sigc++-2.0/sigc++/sigc++.h:80,
from /usr/include/glibmm-2.4/glibmm/thread.h:58,
from /usr/include/glibmm-2.4/glibmm.h:87,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from vista.cpp:2:
/usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:2373:7: note: candidate is:
class bound_const_mem_functor1
^
/usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:2402:12: note: T_return sigc::bound_const_mem_functor1<T_return, T_obj, T_arg1>::operator()(typename sigc::type_trait<T_arg3>::take) const [with T_return = void; T_obj = sigc::signal<void, int>; T_arg1 = const int&; typename sigc::type_trait<T_arg3>::take = const int&]
T_return operator()(typename type_trait<T_arg1>::take _A_a1) const
^
/usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:2402:12: note: candidate expects 1 argument, 0 provided
In file included from /usr/include/sigc++-2.0/sigc++/functors/slot.h:7:0,
from /usr/include/sigc++-2.0/sigc++/signal_base.h:29,
from /usr/include/sigc++-2.0/sigc++/signal.h:8,
from /usr/include/sigc++-2.0/sigc++/sigc++.h:80,
from /usr/include/glibmm-2.4/glibmm/thread.h:58,
from /usr/include/glibmm-2.4/glibmm.h:87,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from vista.cpp:2:
/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:251:21: error: return-statement with a value, in function returning 'void' [-fpermissive]
{ return functor_(); }
^
make: *** [all] Error 1
[The actual class is called "Vista"]
So well, I have no idea what that means! Moreover this had already happened and somehow I managed to solve it but after some reformat and redesign it showed up again and I don't know what to do. It definitely has to do with the combo->signal_clicked().connect(...) line, because when I remove it compiles fine.
I found out what was wrong: the signal I'm trying to emit is of type sigc::signal so it should take one int as an argument when emitted, but I wasn't passing any arguments
Please try to used below namespace:
namespace sigc { SIGC_FUNCTORS_HAVE_RESULT_TYPE }

copying between instances of different variant template classes

Why does one variant assignment compile while the other does not? The template instances do not share any types and char could be converted to int, say. What is boost::variant trying to do, that it cannot do in the case of the first assignment and that it can do in the case of the second assignment? Error is below.
#include <string>
#include "boost/variant.hpp"
int main()
{
boost::variant<char> v1;
boost::variant<std::string, int, double> v2;
v1 = v2; // compile error
v2 = v1; // compiles fine
return 0;
}
In file included from /usr/include/boost/variant.hpp:17:0,
from v.cpp:3:
/usr/include/boost/variant/variant.hpp: In instantiation of 'int boost::variant<T0, TN>::convert_copy_into::internal_visit(T&, int) const [with T = const std::basic_string<char>; T0_ = char; TN = {}]':
/usr/include/boost/variant/detail/visitation_impl.hpp:113:9: required from 'typename Visitor::result_type boost::detail::variant::visitation_impl_invoke_impl(int, Visitor&, VoidPtrCV, T*, mpl_::true_) [with Visitor = boost::variant<char>::convert_copy_into; VoidPtrCV = const void*; T = std::basic_string<char>; typename Visitor::result_type = int; mpl_::true_ = mpl_::bool_<true>]'
/usr/include/boost/variant/detail/visitation_impl.hpp:156:9: required from 'typename Visitor::result_type boost::detail::variant::visitation_impl_invoke(int, Visitor&, VoidPtrCV, T*, NoBackupFlag, int) [with Visitor = boost::variant<char>::convert_copy_into; VoidPtrCV = const void*; T = std::basic_string<char>; NoBackupFlag = boost::variant<std::basic_string<char>, int, double>::has_fallback_type_; typename Visitor::result_type = int]'
/usr/include/boost/variant/detail/visitation_impl.hpp:237:5: required from 'typename Visitor::result_type boost::detail::variant::visitation_impl(int, int, Visitor&, VoidPtrCV, mpl_::false_, NoBackupFlag, Which*, step0*) [with Which = mpl_::int_<0>; step0 = boost::detail::variant::visitation_impl_step<boost::mpl::l_iter<boost::mpl::l_item<mpl_::long_<3l>, std::basic_string<char>, boost::mpl::l_item<mpl_::long_<2l>, int, boost::mpl::l_item<mpl_::long_<1l>, double, boost::mpl::l_end> > > >, boost::mpl::l_iter<boost::mpl::l_end> >; Visitor = boost::variant<char>::convert_copy_into; VoidPtrCV = const void*; NoBackupFlag = boost::variant<std::basic_string<char>, int, double>::has_fallback_type_; typename Visitor::result_type = int; mpl_::false_ = mpl_::bool_<false>]'
/usr/include/boost/variant/variant.hpp:2245:13: required from 'static typename Visitor::result_type boost::variant<T0, TN>::internal_apply_visitor_impl(int, int, Visitor&, VoidPtrCV) [with Visitor = boost::variant<char>::convert_copy_into; VoidPtrCV = const void*; T0_ = std::basic_string<char>; TN = {int, double}; typename Visitor::result_type = int]'
/usr/include/boost/variant/variant.hpp:2267:13: [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/boost/variant/variant.hpp:1581:13: required from 'void boost::variant<T0, TN>::convert_construct_variant(Variant&) [with Variant = const boost::variant<std::basic_string<char>, int, double>; T0_ = char; TN = {}]'
/usr/include/boost/variant/variant.hpp:1628:42: required from 'void boost::variant<T0, TN>::convert_construct(const boost::variant<U0, UN ...>&, long int) [with U0 = std::basic_string<char>; UN = {int, double}; T0_ = char; TN = {}]'
/usr/include/boost/variant/variant.hpp:1649:38: required from 'boost::variant<T0, TN>::variant(const T&) [with T = boost::variant<std::basic_string<char>, int, double>; T0_ = char; TN = {}]'
/usr/include/boost/variant/variant.hpp:2059:29: required from 'void boost::variant<T0, TN>::assign(const T&) [with T = boost::variant<std::basic_string<char>, int, double>; T0_ = char; TN = {}]'
/usr/include/boost/variant/variant.hpp:2099:19: required from 'boost::variant<T0, TN>& boost::variant<T0, TN>::operator=(const T&) [with T = boost::variant<std::basic_string<char>, int, double>; T0_ = char; TN = {}]'
v.cpp:10:6: required from here
/usr/include/boost/variant/variant.hpp:1366:61: error: no matching function for call to 'boost::variant<char>::initializer::initialize(void* const&, const std::basic_string<char>&)'
return initializer::initialize(storage_, operand);
^
/usr/include/boost/variant/variant.hpp:1366:61: note: candidates are:
In file included from /usr/include/boost/variant/variant.hpp:32:0,
from /usr/include/boost/variant.hpp:17,
from v.cpp:3:
/usr/include/boost/variant/detail/initializer.hpp:104:24: note: static int boost::detail::variant::make_initializer_node::apply<BaseIndexPair, Iterator>::initializer_node::initialize(void*, boost::detail::variant::make_initializer_node::apply<BaseIndexPair, Iterator>::initializer_node::param_T) [with BaseIndexPair = boost::mpl::pair<boost::detail::variant::initializer_root, mpl_::int_<0> >; Iterator = boost::mpl::l_iter<boost::mpl::list1<char> >; boost::detail::variant::make_initializer_node::apply<BaseIndexPair, Iterator>::initializer_node::param_T = const char&]
static int initialize(void* dest, param_T operand)
^
/usr/include/boost/variant/detail/initializer.hpp:104:24: note: no known conversion for argument 2 from 'const std::basic_string<char>' to 'boost::detail::variant::make_initializer_node::apply<boost::mpl::pair<boost::detail::variant::initializer_root, mpl_::int_<0> >, boost::mpl::l_iter<boost::mpl::list1<char> > >::initializer_node::param_T {aka const char&}'
/usr/include/boost/variant/detail/initializer.hpp:115:24: note: static int boost::detail::variant::make_initializer_node::apply<BaseIndexPair, Iterator>::initializer_node::initialize(void*, boost::detail::variant::make_initializer_node::apply<BaseIndexPair, Iterator>::initializer_node::param2_T) [with BaseIndexPair = boost::mpl::pair<boost::detail::variant::initializer_root, mpl_::int_<0> >; Iterator = boost::mpl::l_iter<boost::mpl::list1<char> >; boost::detail::variant::make_initializer_node::apply<BaseIndexPair, Iterator>::initializer_node::param2_T = char&&]
static int initialize(void* dest, param2_T operand)
^
/usr/include/boost/variant/detail/initializer.hpp:115:24: note: no known conversion for argument 2 from 'const std::basic_string<char>' to 'boost::detail::variant::make_initializer_node::apply<boost::mpl::pair<boost::detail::variant::initializer_root, mpl_::int_<0> >, boost::mpl::l_iter<boost::mpl::list1<char> > >::initializer_node::param2_T {aka char&&}'
/usr/include/boost/variant/detail/initializer.hpp:149:17: note: static void boost::detail::variant::initializer_root::initialize()
static void initialize();
^
/usr/include/boost/variant/detail/initializer.hpp:149:17: note: candidate expects 0 arguments, 2 provided
A char definitely can be stored in an int but the converse is not always true. Therefore the one that fails to compile would be unsafe at runtime, so you're probably better off with it failing. Cast the int to a char if you must.

Extending on boost::filesystem::path and overloading assignment operator

I know there are already several topics related to overloading the copy and assignment operators of base classes - but after two days of trying, I wasn't able to properly do this using boost::filesystem::path.
What I currently have:
using namespace boost::filesystem;
class MyPath: public path
{
public:
template<class C>
MyPath(const C* p): path(p)// dispatch to base copy constructor
{
//http://stackoverflow.com/questions/1226634/how-to-use-base-classs-constructors-and-assignment-operator-in-c
//this one seems to be OK
}
MyPath& operator=(const MyPath& p)
{
path::operator=(p);
return *this;
}
bool myStuff(){/*...*/}
/* ... */
}
Then, I use the MyPath class just like 'path' before:
using namespace std;
using namespace boost::filesystem;
list<MyPath> files_list;
MyPath input_folder("a valid path");
copy(recursive_directory_iterator(input_folder), recursive_directory_iterator(), back_inserter(files_list));
This code works OK with path, but with MyPath I have problems with the assignment operator, and I haven't figured out how yet what is the format of the operator= that it's required by the std::list and the iterators..
g++ -g -Ic:/mingw/include -c main.cpp
In file included from c:\mingw\include\c++\4.8.1\bits\char_traits.h:39:0,
from c:\mingw\include\c++\4.8.1\ios:40,
from c:\mingw\include\c++\4.8.1\ostream:38,
from c:\mingw\include\c++\4.8.1\iostream:39,
from main.cpp:1:
c:\mingw\include\c++\4.8.1\bits\stl_algobase.h: In instantiation of 'static _OI std::__copy_move<<anonymous>, <anonymous>, <template-parameter-1-3> >::__copy_m(_II, _II, _OI) [with _II = boost::filesystem::recursive_directory_iterator; _OI = std::back_insert_iterator<std::list<MyPath> >; bool <anonymous> = false; bool <anonymous> = false; <template-parameter-1-3> = std::input_iterator_tag]':
c:\mingw\include\c++\4.8.1\bits\stl_algobase.h:390:70: required from '_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = boost::filesystem::recursive_directory_iterator; _OI = std::back_insert_iterator<std::list<MyPath> >]'
c:\mingw\include\c++\4.8.1\bits\stl_algobase.h:428:38: required from '_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = boost::filesystem::recursive_directory_iterator; _OI = std::back_insert_iterator<std::list<MyPath> >]'
c:\mingw\include\c++\4.8.1\bits\stl_algobase.h:460:17: required from '_OI std::copy(_II, _II, _OI) [with _II = boost::filesystem::recursive_directory_iterator; _OI = std::back_insert_iterator<std::list< MyPath> >]'
main.cpp:23:115: required from here
c:\mingw\include\c++\4.8.1\bits\stl_algobase.h:305:16: error: no match for 'operator=' (operand types are 'std::back_insert_iterator<std::list<MyPath> >' and 'boost::filesystem::directory_entry')
*__result = *__first;
^
c:\mingw\include\c++\4.8.1\bits\stl_algobase.h:305:16: note: candidates are:
In file included from c:\mingw\include\c++\4.8.1\bits\stl_algobase.h:67:0,
from c:\mingw\include\c++\4.8.1\bits\char_traits.h:39,
from c:\mingw\include\c++\4.8.1\ios:40,
from c:\mingw\include\c++\4.8.1\ostream:38,
from c:\mingw\include\c++\4.8.1\iostream:39,
from main.cpp:1:
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:436:7: note: std::back_insert_iterator<_Container>& std::back_insert_iterator<_Container>::operator=(const typename _Container::value_type&) [with _Container = std::list<MyPath>; typename _Container::value_type = MyPath]
operator=(const typename _Container::value_type& __value)
^
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:436:7: note: no known conversion for argument 1 from 'boost::filesystem::directory_entry' to 'const value_type& {aka const MyPath&}'
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:443:7: note: std::back_insert_iterator<_Container>& std::back_insert_iterator<_Container>::operator=(typename _Container::value_type&&) [with _Container = std::list<MyPath>; typename _Container::value_type = MyPath]
operator=(typename _Container::value_type&& __value)
^
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:443:7: note: no known conversion for argument 1 from 'boost::filesystem::directory_entry' to 'std::list<MyPath>::value_type&& {aka MyPath&&}'
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:402:11: note: std::back_insert_iterator<std::list<MyPath> >& std::back_insert_iterator<std::list<MyPath> >::operator=(const std::back_insert_iterator<std::list< MyPath> >&)
class back_insert_iterator
^
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:402:11: note: no known conversion for argument 1 from 'boost::filesystem::directory_entry' to 'const std::back_insert_iterator<std::list<MyPath> >&'
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:402:11: note: std::back_insert_iterator<std::list<MyPath> >& std::back_insert_iterator<std::list<MyPath> >::operator=(std::back_insert_iterator<std::list<MyPath> >&&)
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:402:11: note: no known conversion for argument 1 from 'boost::filesystem::directory_entry' to 'std::back_insert_iterator<std::list<MyPath> >&&'
make: *** [main.o] Error 1
The compiler is telling you what you need:
'operator=' (operand types are 'std::back_insert_iterator<std::list<MyPath> >' and 'boost::filesystem::directory_entry')
So you need to implement one more method (at least).