• Advertisement
Sign in to follow this  

boost::signals2 combiner not compiling...

This topic is 1249 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

According to the documentation, I should be able to do the following:
 

#include <boost/signals2.hpp>
 
struct and_combiner
{
    typedef bool result_type;
 
    template <typename InputIterator>
    bool operator() (InputIterator first, InputIterator last) const
    {
        for(;first != last; ++first)
            if(*first == false)
                return false;
        return true;
    }
};
 
int main()
{
    boost::signals2::signal<void (), and_combiner> sig;
    sig();
    return 0;
}
Apparently not!

main.cpp: In instantiation of ‘bool and_combiner::operator()(InputIterator, InputIterator) const [with InputIterator = boost::signals2::detail::slot_call_iterator_t<boost::signals2::detail::signal0_impl<void, and_combiner, int, std::less<int>, boost::function<void()>, boost::function<void(const boost::signals2::connection&)>, boost::signals2::mutex>::slot_invoker, std::_List_iterator<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<boost::signals2::detail::slot_meta_group, boost::optional<int> >, boost::signals2::slot0<void, boost::function<void()> >, boost::signals2::mutex> > >, boost::signals2::detail::connection_body<std::pair<boost::signals2::detail::slot_meta_group, boost::optional<int> >, boost::signals2::slot0<void, boost::function<void()> >, boost::signals2::mutex> >]’:
/usr/include/boost/signals2/detail/result_type_wrapper.hpp:53:38:   required from ‘boost::signals2::detail::combiner_invoker<R>::result_type boost::signals2::detail::combiner_invoker<R>::operator()(Combiner&, InputIterator, InputIterator) const [with Combiner = and_combiner; InputIterator = boost::signals2::detail::slot_call_iterator_t<boost::signals2::detail::signal0_impl<void, and_combiner, int, std::less<int>, boost::function<void()>, boost::function<void(const boost::signals2::connection&)>, boost::signals2::mutex>::slot_invoker, std::_List_iterator<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<boost::signals2::detail::slot_meta_group, boost::optional<int> >, boost::signals2::slot0<void, boost::function<void()> >, boost::signals2::mutex> > >, boost::signals2::detail::connection_body<std::pair<boost::signals2::detail::slot_meta_group, boost::optional<int> >, boost::signals2::slot0<void, boost::function<void()> >, boost::signals2::mutex> >; R = bool; boost::signals2::detail::combiner_invoker<R>::result_type = bool]’
/usr/include/boost/signals2/detail/signal_template.hpp:246:13:   required from ‘boost::signals2::detail::signal0_impl<R, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex>::result_type boost::signals2::detail::signal0_impl<R, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex>::operator()() [with R = void; Combiner = and_combiner; Group = int; GroupCompare = std::less<int>; SlotFunction = boost::function<void()>; ExtendedSlotFunction = boost::function<void(const boost::signals2::connection&)>; Mutex = boost::signals2::mutex; boost::signals2::detail::signal0_impl<R, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex>::result_type = bool]’
/usr/include/boost/signals2/detail/signal_template.hpp:695:85:   required from ‘boost::signals2::signal0<R, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex>::result_type boost::signals2::signal0<R, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex>::operator()() [with R = void; Combiner = and_combiner; Group = int; GroupCompare = std::less<int>; SlotFunction = boost::function<void()>; ExtendedSlotFunction = boost::function<void(const boost::signals2::connection&)>; Mutex = boost::signals2::mutex; boost::signals2::signal0<R, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex>::result_type = bool]’
main.cpp:20:9:   required from here
main.cpp:11:13: error: no match for ‘operator==’ in ‘((boost::iterator_facade<boost::signals2::detail::slot_call_iterator_t<boost::signals2::detail::signal0_impl<void, and_combiner, int, std::less<int>, boost::function<void()>, boost::function<void(const boost::signals2::connection&)>, boost::signals2::mutex>::slot_invoker, std::_List_iterator<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<boost::signals2::detail::slot_meta_group, boost::optional<int> >, boost::signals2::slot0<void, boost::function<void()> >, boost::signals2::mutex> > >, boost::signals2::detail::connection_body<std::pair<boost::signals2::detail::slot_meta_group, boost::optional<int> >, boost::signals2::slot0<void, boost::function<void()> >, boost::signals2::mutex> >, boost::signals2::detail::void_type, boost::single_pass_traversal_tag, const boost::signals2::detail::void_type&, long int>*)(& first))->boost::iterator_facade<I, V, TC, R, D>::operator*<boost::signals2::detail::slot_call_iterator_t<boost::signals2::detail::signal0_impl<void, and_combiner, int, std::less<int>, boost::function<void()>, boost::function<void(const boost::signals2::connection&)>, boost::signals2::mutex>::slot_invoker, std::_List_iterator<boost::shared_ptr<boost::signals2::detail::connection_body<std::pair<boost::signals2::detail::slot_meta_group, boost::optional<int> >, boost::signals2::slot0<void, boost::function<void()> >, boost::signals2::mutex> > >, boost::signals2::detail::connection_body<std::pair<boost::signals2::detail::slot_meta_group, boost::optional<int> >, boost::signals2::slot0<void, boost::function<void()> >, boost::signals2::mutex> >, boost::signals2::detail::void_type, boost::single_pass_traversal_tag, const boost::signals2::detail::void_type&, long int>() == false’
main.cpp:11:13: note: candidate is:
In file included from /usr/include/boost/signals2/detail/slot_call_iterator.hpp:22:0,
                 from /usr/include/boost/signals2/signal.hpp:28,
                 from /usr/include/boost/signals2.hpp:19,
                 from main.cpp:1:
/usr/include/boost/signals2/detail/auto_buffer.hpp:1086:17: note: template<class T, class SBP, class GP, class A> bool boost::signals2::detail::operator==(const boost::signals2::detail::auto_buffer<T, SBP, GP, A>&, const boost::signals2::detail::auto_buffer<T, SBP, GP, A>&)
/usr/include/boost/signals2/detail/auto_buffer.hpp:1086:17: note:   template argument deduction/substitution failed:
main.cpp:11:13: note:   ‘const boost::signals2::detail::void_type’ is not derived from ‘const boost::signals2::detail::auto_buffer<T, SBP, GP, A>’
Edited by TheComet

Share this post


Link to post
Share on other sites
Advertisement

Maybe my boost::signal is a bit rusty but how is a combiner supposed to work with functions which return void?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement