#include <iostream>
#include <vector>
#include <boost/ref.hpp>
struct Foo
{
int i;
};
std::vector<boost::reference_wrapper<const Foo> > foos;
void store(const Foo& container)
{
foos.push_back(boost::cref(container));
}
int main()
{
Foo f = {5};
const Foo f1(f);
store(f);
store(f);
store(f);
store(f1);
std::cout << foos[0].get().i << "\n";
std::cout << foos[1].get().i << "\n";
std::cout << foos[2].get().i << "\n";
std::cout << foos[3].get().i << "\n";
}