[ create a new paste ] login | about

Link: http://codepad.org/PerhH6HB    [ raw code | output | fork ]

hecomi - C++, pasted on Jun 27:
#include <iostream>
#include <vector>
#include <list>
#include <iterator>
#include <algorithm>

template <class T, template<class A, class Allocator = allocator<A> > class Container>
void print(Container<T> cont)
{
    std::copy(cont.begin(), cont.end(), std::ostream_iterator<T>(std::cout, " "));
}

int main()
{
    std::vector<int> vec;
    std::list<int> lis;
    vec.push_back(0);vec.push_back(3);vec.push_back(1);vec.push_back(6);
    lis.push_back(1);lis.push_back(2);lis.push_back(3);lis.push_back(4);
    print(vec);
    std::cout << endl;
    print(lis);
    return 0;
}


Output:
1
2
0 3 1 6 
1 2 3 4 


Create a new paste based on this one


Comments: