boost信号调用函数采用常量对象引用

时间:2012-06-26 08:39:02

标签: boost signals-slots

这是增强信号定义

    boost::signal<void (const MetaData&)> sigChangeTrackMD;

应该在命名空间GSTREAMER中调用函数changeTrack

void changeTrack(const MetaData& md){.....}

信号连接

sigChangeTrackMD.connect(GSTREAMER::changeTrack);

但是会出现以下错误。声明是错的吗?

Engine/GSTAdaptor.cpp:21:44: error: no match for call to '(boost::signal<void(const MetaData&)>) (<unresolved overloaded function type>)'
/usr/include/boost/signal.hpp:329:9: note: candidates are:
/usr/include/boost/signals/signal_template.hpp:330:1: note: boost::signal1<R, T1, Combiner, Group, GroupCompare, SlotFunction>::result_type boost::signal1<R, T1, Combiner, Group, GroupCompare, SlotFunction>::operator()(T1) [with R = void, T1 = const MetaData&, Combiner = boost::last_value<void>, Group = int, GroupCompare = std::less<int>, SlotFunction = boost::function<void(const MetaData&)>, boost::signal1<R, T1, Combiner, Group, GroupCompare, SlotFunction>::result_type = void]
/usr/include/boost/signals/signal_template.hpp:330:1: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const MetaData&'
/usr/include/boost/signals/signal_template.hpp:370:1: note: boost::signal1<R, T1, Combiner, Group, GroupCompare, SlotFunction>::result_type boost::signal1<R, T1, Combiner, Group, GroupCompare, SlotFunction>::operator()(T1) const [with R = void, T1 = const MetaData&, Combiner = boost::last_value<void>, Group = int, GroupCompare = std::less<int>, SlotFunction = boost::function<void(const MetaData&)>, boost::signal1<R, T1, Combiner, Group, GroupCompare, SlotFunction>::result_type = void]
/usr/include/boost/signals/signal_template.hpp:370:1: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const MetaData&'
Engine/GSTAdaptor.cpp:22:42: error: no match for call to '(boost::signal<void(std::basic_string<char>&)>) (<unresolved overloaded function type>)'
/usr/include/boost/signal.hpp:329:9: note: candidates are:
/usr/include/boost/signals/signal_template.hpp:330:1: note: boost::signal1<R, T1, Combiner, Group, GroupCompare, SlotFunction>::result_type boost::signal1<R, T1, Combiner, Group, GroupCompare, SlotFunction>::operator()(T1) [with R = void, T1 = std::basic_string<char>&, Combiner = boost::last_value<void>, Group = int, GroupCompare = std::less<int>, SlotFunction = boost::function<void(std::basic_string<char>&)>, boost::signal1<R, T1, Combiner, Group, GroupCompare, SlotFunction>::result_type = void]
/usr/include/boost/signals/signal_template.hpp:330:1: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_string<char>&'
/usr/include/boost/signals/signal_template.hpp:370:1: note: boost::signal1<R, T1, Combiner, Group, GroupCompare, SlotFunction>::result_type boost::signal1<R, T1, Combiner, Group, GroupCompare, SlotFunction>::operator()(T1) const [with R = void, T1 = std::basic_string<char>&, Combiner = boost::last_value<void>, Group = int, GroupCompare = std::less<int>, SlotFunction = boost::function<void(std::basic_string<char>&)>, boost::signal1<R, T1, Combiner, Group, GroupCompare, SlotFunction>::result_type = void]
/usr/include/boost/signals/signal_template.hpp:370:1: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_string<char>&'
make: *** [GSTAdaptor.o] Error 1

0 个答案:

没有答案