Skip to content

Instantly share code, notes, and snippets.

@hajimehoshi
Created January 5, 2011 06:05
Show Gist options
  • Save hajimehoshi/765993 to your computer and use it in GitHub Desktop.
Save hajimehoshi/765993 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <boost/range.hpp>
class foo {
private:
int values_[10];
public:
typedef decltype(values_) values_type;
foo()
: values_{3, 1, 4, 1, 5, 9, 2, 6, 5, 3} {
}
const values_type&
values() {
return this->values_;
}
};
int main() {
foo foo_;
auto it = boost::begin(foo_.values());
auto it_end = boost::end(foo_.values());
for (; it != it_end; ++it) {
std::cout << *it << std::endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment