My thoughts are something like:
Because it avoids several overloads of the same code and allows for polymorphism.Code:template<typename DataT> bool inline InternalValidator(const DataT& Data) { return true; }
template< typename DataT, typename StringT, typename Validator = &InternalValidator<DataT>, typename InputStream = std::basic_istream<StringT> >
class Input
{
public:
Input(const StringT& Question, const StringT& ErrorType, const StringT& ErrorValidation, Validator ValidatorFnc);
Input(const StringT& Question, const StringT& ErrorType);
Input(const StringT& Question);
Input();
Input& operator >> (DataT& rhs);
protected:
virtual bool Convert(const StringT& ConvertFrom, const DataT& ConvertTo);
StringT m_Data;
};
Potentially, the constructor asks and fetches the answer, as well as validated and loops until the answer is valid.
The answer is then converted and extracted through the >> operator.