Skip to content

Instantly share code, notes, and snippets.

@mondoo
Created June 15, 2019 21:05
Show Gist options
  • Select an option

  • Save mondoo/ab41b9f9a19c9ad2670655565a45f74d to your computer and use it in GitHub Desktop.

Select an option

Save mondoo/ab41b9f9a19c9ad2670655565a45f74d to your computer and use it in GitHub Desktop.
#include <iostream>
template<typename T>
struct Vector {
T x;
T y;
public:
Vector(T inX, T inY)
{
x = inX;
y = inY;
}
};
int main()
{
Vector<int> xy = Vector<int>(10, 10);
for (int x = 0, y = 0;
x < xy.x && y < xy.y;
x++, x >= xy.x ? (x = 0, y++) : 0)
{
std::cout << "x: " << x << " y: " << y << std::endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment