Re: [sigc] Expected results of tests/test_functor_traits and visit_each behavior?




2014-02-18 02:16, Ryan Beasley skrev:
Hi all, 

I'm observing some odd behavior with one of libsigc++'s tests, and I'm wondering whether there's a problem with my patch or the test itself.

====
  sigc::visit_each(
    print(),
    sigc::compose(                         > A
      sigc::bind(sigc::ptr_fun3(&foo),    \
                 sigc::ref(a),             > B
                 i),                      /
      sigc::ptr_fun1(&bar)));              > C

  util->check_result(result_stream, "hit all targets: other other ");
====

It appears that unmodified visit_each doesn't dig into sigc::compose's parameters, so it fails to visit each of the leaf types individually.  With my patch, I'm observing different visitor output, but which I believe to be correct.

  Expected "hit all targets: other other "
  Got      "hit all targets: other trackable int: 1other "

So, who's wrong?  Me, the test, or both?
The test looks wrong. You mention a patch. Can you show what you've modified? Perhaps you can attach your patch to your bug 724496. Or file another bug, it you think this error is unrelated to the one in bug 724496.
====
Type of A
---------
  sigc::compose1_functor<B, C>

  Visiting results in
     visit_each<T_action, B>(_A_action, _A_target.functor_); (_A_target.functor_ is instance of B.)
     visit_each<T_action, C>(_A_action, _A_target.get_);     (_A_target.get_ is instance of C.)
     
Type of B
---------
  sigc::bind_functor<
    -1,
    sigc::pointer_functor3<int, int, int, void>,            > type D
    sigc::reference_wrapper<{anonymous}::A>,                > type E
    int, (5 sigc::nils)>

  Visiting results in

    visit_each<T_action, sigc::pointer_functor3<int, int, int, void> >(_A_action, _A_target.functor_);
    visit_each<T_action, sigc::reference_wrapper<{anonymous}::A> >(_A_action, _A_target.bound1_);
    visit_each<T_action, int>(T_action, _A_target.bound2_);

  Visiting type D leads to
    print<D> -> "other"
  
  Visiting type E leads to
     visit_each<{anonymous}::print, sigc::bound_argument<sigc::reference_wrapper<{anonymous}::A> > >
      \--- visit_each<{anonymous}::print, sigc::limit_reference<{anonymous}::A, false> >
       \--- visit_each<{anonymous}::print, {anonymous}::A>
        \--- with_trackable<::A, true> -> "trackable"

  Visiting int leads to
    print<int> -> "int 1"
     
Type of C
---------
  sigc::pointer_functor1<int, void>

  Visiting results in
    visit_each<T_action, sigc::pointer_functor1<int, void> >(_A_action, _A_target.functor_);

    print<C> -> "other"

1. https://bugzilla.gnome.org/show_bug.cgi?id=724496
_______________________________________________




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]