[ create a new paste ] login | about

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

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

template <class A, template<class T, class Allocator=std::allocator<T> > class Container>
class hoge {
private:
    Container<A> Cont;

public:
template <class T>
    hoge (T cont) {
        std::copy(cont.begin(), cont.end(), ostream_iterator<A>(std::cout, " "));
    }
};

int main()
{
    std::vector<int> vec;
    vec.push_back(0);vec.push_back(3);vec.push_back(1);vec.push_back(6);
    hoge<int, std::vector> h(vec);
    return 0;
}


Output:
1
0 3 1 6 


Create a new paste based on this one


Comments: