Created
October 8, 2013 20:41
-
-
Save pikajude/6891278 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class T, class V, class Fn> | |
vector<V> flat_map(vector<T> elems, Fn trans) { | |
vector<V> results; | |
for (auto elem: elems) { | |
auto inte = trans(elem); | |
results.insert(results.end(), inte.begin(), inte.end()); | |
} | |
return results; | |
} | |
vector<Result> Board::find(vector<string> strings) { | |
return flat_map(strings, [](string s) { | |
return vector<Result>(); | |
}); | |
} | |
/* | |
solve.cpp:88:10: error: no matching function for call to 'flat_map' | |
return flat_map(strings, [](string s) { | |
^~~~~~~~ | |
solve.cpp:78:11: note: candidate template ignored: couldn't infer template argument 'V' | |
vector<V> flat_map(vector<T> elems, Fn trans) { | |
^ | |
1 error generated. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment