A template is only a pattern not code, DoFoo cannot be bound to because it doesn’t exist so you can’t do what you want, for more details have a look here : http://www.parashift.com/c++-faq-lite/templates.html#faq-35.15.

 

Do you really need a template function for this, just overload a function with one converting the char* into a std::string or visa versa

 


From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Robert Dailey
Sent: 05 March 2008 16:37
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] [bind] Template deduction

 

On Tue, Mar 4, 2008 at 7:16 PM, Marshall Clow <marshall@idio.com> wrote:

Would this work?

     std::for_each( myStrings.begin(), myStrings.end(), boost::bind(

&DoFoo<std::string>, 5, _1 ) );


Well, the example I gave was probably overly simple. The real example uses a boost::python::list, which can either take a char* or a std::string. At the time I'm doing the boost::bind, I do not know what type is being passed in.

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________


******************************************************************************

"This message and any attachments are solely for the intended recipient and may contain confidential and privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."

Interactive Transaction Solutions Ltd (2473364 England)

Registered Office:
Systems House,
Station Approach
Emsworth PO10 7PW

**********************************************************************

Ce message ?lectronique contient des informations confidentielles ? l'usage unique des destinataires indiqu?s, personnes physiques ou morales. Si vous n'?tes pas le destinataire voulu, toute divulgation, copie, ou diffusion ou toute autre utilisation de ces informations, est interdite. Si vous avez re?u ce message ?lectronique par erreur, nous vous remercions d'en avertir son exp?diteur imm?diatement par email et de d?truire ce message ainsi que les ?l?ments attach?s.

Interactive transaction Solutions SAS- France (RCS Pontoise : 489 397 877)

Si?ge social :
Parc Saint Christophe,
10, Avenue de l?Entreprise
95865 Cergy-Pontoise Cedex

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________