std::function<double()>
ラムダ式に割り当てています。このスニペットは機能します
if(fn_type==exponential)
k.*variable = [=,&k](){ return initial*exp(-k.kstep*par); };
else
k.*variable = [=,&k](){ return initial*pow(k.kstep, par); };
一方、三項演算子を使用したい場合
k.*variable = (fn_type==exponential ? [=,&k](){ return initial*exp(-k.kstep*par); } : [=,&k](){ return initial*pow(k.kstep, par); });
次のエラーが発生します。
error: no match for ternary ‘operator?:’ in <awfully long template error, because this whole thing is in a class defined in a function...>
これはgccのバグですか(4.7.2を使用しています)?そうでなければ、なぜ標準にこの制限があるのですか?