I would like to have a constructor with default argument static_cast like:
generate_word_spot(func_double_double_t& cost_f = static_cast<func_double_double_t&>(func_const_t(1))) :
cost_f_(cost_f)
{};
where
class func_const_t : public func_double_double_t
{
...
virtual double operator()(double x){ ... };
}
and func_double_double_t
is the base class for many function objects similar to this.
GCC says "invalid static_cast
" for the above constructor. Is there a way to achieve such a behavior?