クラスを適切に設計できなかったため、次のようなものが必要になるようになりました。
struct A
{
A( function< void(string&) cb > ): callback(cb) {}
function< void(string&) > callback;
template <std::size_t T>
void func( string& str) { ... }
}
int main(){
vector<A> items = {
A( bind( &A::func<1>, items[0], _1) ),
A( bind( &A::func<2>, items[1], _1) ),
...
}
これは安全に使用できますか?そうでない場合、代替手段はありますか?