Hi all.
I've been using boost::bind to work around deficiencies with
std::mem_fun_ref and std::bind2nd under MSVC6.
I have a class called CDocumentAttachments which had a member
function thus:
HINSTANCE Execute(LPCTSTR verb) const;
I was using bind with this as follows:
for_each(filenames.begin(),
filenames.end(),
bind(&CDocumentAttachments::Execute, _1, _T("print")));
"filenames" is a const vector of CDocumentAttachments objects.
This worked fine.
A little later on in development, I changed the function signature for
CDocumentAttachments::Execute to:
HINSTANCE Execute(LPCTSTR verb, bool visible) const;
How will I pass the extra bool to bind? I can't find any examples of
passing more than one parameter to a member function.
I thought about (among many others)
for_each(filenames.begin(),
filenames.end(),
bind(&CDocumentAttachments::Execute, _2, _T("print"),
false));
but the compiler (VC6) complains with two of the following:
k:\vc\include\boost\bind.hpp(760) : error C2679: binary '[' : no
operator
defined which takes a right-hand operand of type 'const class
boost::arg<2>'
(or there is no acceptable conversion)
k:\vc\include\boost\bind\bind_template.hpp(33) : see
reference to
function template instantiation 'struct HINSTANCE__ *__cdecl
boost::_bi::evaluator3