Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Legibilidade com C++14 - get_numeric
template<class OutputIterator, class ValueType>
struct numerical_appender {
numerical_appender(OutputIterator it) : _it(it) { }
void operator()(const ValueType c) {
if( c >= '0' && c <= '9' ) {
*_it = c;
OutputIterator _it;
template<class T>
void get_numeric(const T &input, T &output)
typedef std::back_insert_iterator<T> it_type;
it_type it = std::back_inserter(output);
numerical_appender<it_type, typename T::value_type> appender(it);
std::for_each(input.begin(), input.end(), appender);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.