Boost.Localがmoファイルをロードするために関数コールバックを使用する次のコードがあります。この関数は私にとってはfindMoと呼ばれ、オブジェクトにバインドしようとしているので、私がmoFinderのプライベートメンバーに加えた副作用を残すことができます。私はブースト::バインド呼び出しラインでBoost.Bind非静的メンバー
error: invalid use of non-static member function ‘std::vector moFinder::findMo(const std::string&, const std::string&)’
:コンパイルする場合
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;
// ...
}
は、私は次のエラーを取得します。
このエラーを表示するにはどうすればよいですか?
問題を小さなサンプルに減らしてください。 'boost.locale'とは何も関係ありません。それは純粋に 'バインド'です。これにより、それらをより簡単に診断することができます。 – pmr
私はいつもやっていますが、Boost.Localeの奇妙さと関係があるかどうかは正直に分かりませんでした。 – Jookia