[ create a new paste ] login | about

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

GManNickG - C++, pasted on Oct 25:
#include <iostream>
#include <vector>

struct foo
{
    foo(int x, int y) :
    i(x * y)
    {}

    int i;
};

int main()
{
    std::vector<foo> v;

    v.push_back(foo(1, 2));
    v.push_back(foo(2, 3));
    v.push_back(foo(3, 4));

    for (std::size_t i = 0; i < v.size(); ++i)
        std::cout << v[i].i << std::endl;
}


Output:
1
2
3
2
6
12


Create a new paste based on this one


Comments: