Re: [sigc] How to use sigc::bind<>



Murray Cumming Comneon com wrote:

From: Martin Schulze [mailto:martin-ml hippogriff de] Am 2003.11.10 08:03 schrieb(en) Jeff Franks:
Martin Schulze wrote:

You are right, it seems to work! I'm surprised that the right function overload is chosen automatically for bind() without the number! I hope this is not gcc specific. I will commit this change to cvs. Should we change to zero based argument counting for bind<#>, then? Don't forget that this might cause even more confusion for people who use selectors _1, _2, etc. from any lambda library or bind1st(), bind2nd() from stl. I really don't know what will be more intuitive: 0,1,2... or 1,2,3...

Please do consider not including an API if it can't be done simply. Really,
who needs to bind more than 1 argument?

In general, I prefer 0-based indexing, and 1-based counting.
If you use 0-based indexing and reserved -1 as the end marker (there's that -1 again) no one would have to actually use -1. In the overloaded (or is that specialized) bind functions -1 could be used instead of zero.

template <class T_bound1, class T_functor>
template <class T_bound1, class T_functor>
inline bind_functor<-1, typename unwrap_reference<T_bound1>::type, T_functor>
bind(const T_functor& _A_func, T_bound1 _A_b1)
{
return bind_functor<-1, typename unwrap_reference<T_bound1>::type, T_functor>
         (_A_func, _A_b1);
}

Jeff .




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