From: David Brownell (brownell_at_[hidden])
Date: 2001-10-22 13:13:27
Yes, I am using MSVC - I guess that would be an important piece of
information to include. Are there any slick tricks here, or do I have to
actually make a call to the template function at some point other than
From: Gennadiy E. Rozental [mailto:rogeeff_at_[hidden]]
Sent: Monday, October 22, 2001 11:22 AM
Subject: [boost] Re: bind, template functions, and the linker
What compiler ar you using? If it MSVC it's appears to be known issue
and usin gtemporary could help.
--- In boost_at_y..., brownell_at_a... wrote:
> I don't think this is a problem with bind, but more of a C++ issue,
> so my apologies if this is a bit off topic. I am passing a
> function to bind, and the resulting "bound" function is used as the
> UnaryFunction in std::for_each. When I compile this application,
> everything works as expected, but when the linker does its thing,
> can't find the template function. If I make a dummy call to the
> template function, the function code is created and the linker is
> happy. Is there a way I can make this all work without the dummy
> call to the template function? I have a code example illustrating
> the problem below.
> Thanks in advance for your help!
> #include "boost\bind.hpp"
> template<class T>
> bool TemplateFunction(T &t)
> t = 2;
> int main(void)
> std::vector<unsigned long> v;
> //If this code segment is commented, it will not link.
> // to resolve the link error
> unsigned long ulTemp;
bool (*temp)( unsigned long& ) = &TemplateFunction<unsigned long>;
std::for_each(v.begin(), v.end(), boost::bind(temp, _1));
Info: http://www.boost.org Unsubscribe:
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk