私は一般的な機能を持っています:
void ImageAlbum::ExpressButtonPressed(
boost::function<
void (
thumb::PhotoPrintThumbnail*,
thumb::PhotoPrintFormat,
thumb::PhotoPrintQuantity
)
> memberToCall
) {
...
BOOST_FOREACH(thumb::PhotoPrintThumbnail *pThumbnail, m_thumbs.GetSelected()) {
memberToCall(
pThumbnail,
m_expressSel.GetSelectedFormat(),
m_expressSel.GetSelectedQuantity()
);
}
...
}
私は正常に呼び出すことができます:
ExpressButtonPressed(boost::bind(&thumb::PhotoPrintThumbnail::AddQuantity, _1, _2, _3));
次に、特定のフォーマットをサムネイルに追加するのではなく、それらすべてを 1 つのフォーマットに置き換える必要があります。より正確には、次のように 1 つの要素のリストを使用します。
ExpressButtonPressed(
boost::lambda::bind(
&thumb::PhotoPrintThumbnail::SetFormats,
_1,
boost::lambda::bind(
boost::lambda::constructor<thumb::PhotoPrintThumbnail::LoadedFormats>(),
1,
boost::lambda::bind(
boost::lambda::constructor<thumb::PhotoPrintThumbnail::LoadedFormat>(),
_2,
_3
)
)
)
);
その結果、「boost/lambda/detail/actions.hpp(96): error C2665: 'boost::lambda::function_adaptor::apply': none of the 2 overloads could convert the all argument types".
ここで何が間違っていますか?
ところで
class PhotoPrintThumbnail {
public:
...
typedef std::pair<PhotoPrintFormat, PhotoPrintQuantity> LoadedFormat;
typedef std::list<LoadedFormat> LoadedFormats;
void SetFormats(const LoadedFormats &formats);