ファイルA.hppには、
extern boost::signal<void (model::Bullet&, Point&, Point&, int)> signal_createBullet;
したがって、ファイルA.cppには、
boost::signal<void (model::Bullet&, Point&, Point&, int)> signal_createBullet;
ファイルB.hppには、次のように接続したいEntities
静的メンバー関数を持つクラスがあります:(簡潔にするために名前空間は省略されています)receiveSignalCreateBullet
signal_createBullet
class Entities
{
Entities()
{
signal_createBullet.connect(&receiveSignalCreateBullet);
}
public:
static void receiveSignalCreateBullet(const Bullet&, const Point&, const Point&, const int);
};
inline static void receiveSignalCreateBullet(...) { ... }
そして最後にファイルC.cppで、私は次signal_createBullet
のように使用します。
signal_createBullet(bullet, pos, bulletVector, count);
AとBは(g ++を使用して)正常にコンパイルされますが、Cは次のエラーメッセージで失敗します。
In member function ‘virtual void thrl::model::SingleStream::shoot(const thrl::utl::Point&, const thrl::utl::Point&, const thrl::utl::Point&) const’:
src/Shot.cpp:25: error: no match for call to ‘(boost::signal4<void, thrl::model::Bullet&, thrl::utl::Point&, thrl::utl::Point&, int, boost::last_value<void>, int, std::less<int>, boost::function4<void, thrl::model::Bullet&, thrl::utl::Point&, thrl::utl::Point&, int> >) (const thrl::model::Bullet&, const thrl::utl::Point&, thrl::utl::Point&, int&)’
/usr/local/include/boost/signals/signal_template.hpp:330: note: candidates are: typename boost::signal4<R, T1, T2, T3, T4, Combiner, Group, GroupCompare, SlotFunction>::result_type boost::signal4<R, T1, T2, T3, T4, Combiner, Group, GroupCompare, SlotFunction>::operator()(T1, T2, T3, T4) [with R = void, T1 = thrl::model::Bullet&, T2 = thrl::utl::Point&, T3 = thrl::utl::Point&, T4 = int, Combiner = boost::last_value<void>, Group = int, GroupCompare = std::less<int>, SlotFunction = boost::function4<void, thrl::model::Bullet&, thrl::utl::Point&, thrl::utl::Point&, int>]
/usr/local/include/boost/signals/signal_template.hpp:370: note: typename boost::signal4<R, T1, T2, T3, T4, Combiner, Group, GroupCompare, SlotFunction>::result_type boost::signal4<R, T1, T2, T3, T4, Combiner, Group, GroupCompare, SlotFunction>::operator()(T1, T2, T3, T4) const [with R = void, T1 = thrl::model::Bullet&, T2 = thrl::utl::Point&, T3 = thrl::utl::Point&, T4 = int, Combiner = boost::last_value<void>, Group = int, GroupCompare = std::less<int>, SlotFunction = boost::function4<void, thrl::model::Bullet&, thrl::utl::Point&, thrl::utl::Point&, int>]
これを理解しようとしている間、私は自分の通話とエラーメッセージの最初の候補をフォーマットして、それらをより簡単に比較できるようにしました。
// my call
‘(
boost::signal
<
void
(
thrl::model::Bullet&,
thrl::utl::Point&,
thrl::utl::Point&,
int
),
boost::last_value<void>,
int,
std::less<int>,
boost::function
<
void
(
thrl::model::Bullet&,
thrl::utl::Point&,
thrl::utl::Point&,
int
)
>
>
)
(
const thrl::model::Bullet&,
const thrl::utl::Point&,
thrl::utl::Point&,
int&
)’
// what g++ expects
typename boost::signal4<R, T1, T2, T3, T4, Combiner, Group, GroupCompare, SlotFunction>::result_type
boost::signal4<R, T1, T2, T3, T4, Combiner, Group, GroupCompare, SlotFunction>::operator()(T1, T2, T3, T4)
[ with
R = void,
T1 = thrl::model::Bullet&,
T2 = thrl::utl::Point&,
T3 = thrl::utl::Point&,
T4 = int,
Combiner = boost::last_value<void>,
Group = int,
GroupCompare = std::less<int>,
SlotFunction = boost::function
<
void
(
thrl::model::Bullet&,
thrl::utl::Point&,
thrl::utl::Point&,
int
)
>
]
// the second candidate is the same as the first, except that it's const
候補者が「Portable」構文を使用しているという事実に加えて(そして、いいえ、Portableスタイルを使用するようにコードを切り替えても違いはありません)私の呼び出しの最後のものがint&
候補者が持っている場所であることを除いて、2つの呼び出しの間に違いはありませんint
。_ int
信号からパラメータを削除して、それが問題であるかどうかを確認しようとしましたが、問題はありませんでした。
なぜ私がこのエラーを受け取るのか誰かがわかりますか?