Skip to content

Instantly share code, notes, and snippets.

@CallumHoward
Created June 21, 2018 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CallumHoward/b84aa86677fd40bd0c121bb22bf23d12 to your computer and use it in GitHub Desktop.
Save CallumHoward/b84aa86677fd40bd0c121bb22bf23d12 to your computer and use it in GitHub Desktop.
// for.cpp
// Callum Howard, 2018
#include <iostream>
#include <vector>
class F {
public:
F() : mItems{3, 1, 4, 1, 5, 9, 2} {}
std::vector<int> items() { return mItems; }
private:
std::vector<int> mItems;
};
int main() {
for (const auto& item : F().items()) {
std::cout << item << '\n';
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment