[C++-sig] Possible overload<> template for class members

Joel de Guzman djowel at gmx.co.uk
Sun Dec 15 03:30:26 CET 2002


----- Original Message ----- 
From: "David Abrahams" <dave at boost-consulting.com>

> >     int main()
> >     {
> >         overload(args<>(), &show);
> >         overload(args<int>(), &show);
> >         overload(args<int,bool*>(), &show);
> >         overload(args<int,bool>(), &show);
> >
> >         overload(args<>(), &window::show);
> >         overload(args<int>(), &window::show);
> >         overload(args<int,bool*>(), &window::show);
> >         overload(args<int,bool>(), &window::show);
> >     }
> >
> > Or we can move the 'args' into function templates' template parameter list:
> >
> >         overload_cast< args<int,bool> >(&show);
> 
> That one seems like the nicest syntax I've seen so far.

Why not simply:

   .def("show", overload<>(&Window::show))
   .def("show", overload<int>(&Window::show))
   .def("show", overload<int,bool*>(&Window::show))
   .def("show", overload<int,bool>(&Window::show))

Can't we do that?

Joel de Guzman
joel at boost-consulting.com
http://www.boost-consulting.com








More information about the Cplusplus-sig mailing list