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



> From: Martin Schulze [mailto:martin-ml hippogriff de] 
> Am 2003.11.10 08:03 schrieb(en) Jeff Franks:
> > Martin Schulze wrote:
> > 
> >> Unfortunately, C++ doesn't allow us to specify default template 
> >> arguments for functions. Therefore, the number always needs to be 
> >> specified. Or does somebody know a trick to make the 
> number optional?
> >> 
> > But it lets you overload template functions: This works. I added the
> > following three function template to <sigc++/adaptors/bind.h> as a 
> > test. I quickly tested each one with the example I sent you 
> > previously - and they all works Ok.
> 
> 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.

Murray Cumming
www.murrayc.com
murrayc usa net



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