Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
back_inserter example
//clang 3.8.0 #include <algorithm> #include <iostream> #include <iterator> #include <vector> int main() { std::vector<int> src = {1, 4, 6, 4, 1}; std::vector<int> dest; // Next line crashes the process, as there is no sufficient space in the `dest` vactor. // std::copy(src.cbegin(), src.cend(), dest.begin()); std::copy(src.cbegin(), src.cend(), std::back_inserter(dest)); std::cout << "dest:"; for (auto value: dest) std::cout << " " << value; return 0; }
run
|
edit
|
history
|
help
0
11/29
Throttle Example using circular queue (push all but 2 less than maxSize; then pop all but 2 less than current size)
11/18
Move Construction
boost tokenizer
non-template template parameters for container stream insertion: SFINAE
STL Stack, C ++
SimpleList Example
10226
Sum of Natural Numbers using loop