Boost.Local が関数コールバックを使用して mo ファイルをロードする次のコードがあります。この関数は私にとっては findMo と呼ばれ、moFinder のプライベート メンバーに追加した副作用を保持できるように、それをオブジェクトにバインドしようとしています。
class moFinder
{
public:
moFinder(string const& wantedFormat)
: format(wantedFormat)
{
// ...
}
std::vector<char> findMo(std::string const& filePath, std::string const& encoding)
{
// ...
}
};
std::locale createLocale(string const& name, string const& customTranslation,
string const& path, string const& domain, string const& pathFormat)
{
// ...
namespace blg = boost::locale::gnu_gettext;
blg::messages_info info;
info.paths.push_back(path);
info.domains.push_back(blg::messages_info::domain(domain));
moFinder finder(pathFormat);
blg::messages_info::callback_type callbackFunc;
callbackFunc = boost::bind(moFinder::findMo, boost::ref(finder));
info.callback = callbackFunc;
// ...
}
コンパイルすると、次のエラーが発生します。
エラー: 非静的メンバ関数 'std::vector moFinder::findMo(const std::string&, const std::string&)' の無効な使用</p>
boost::bind を呼び出す行。
このエラーに値するために私は何をしていますか?