Answer as per chryspi request above. As commented in other answers, you cannot use links directly, since links do not exist on their own.
However, you can use the links, but using the utility class boost::reference_wrapper<T> :
typedef boost::reference_wrapper<int> intref; std::vector<intref> v; int i; i = 9; v.push_back (boost::ref (i));
As an example, I will give you how to directly change the element v[0] . Note that this is somewhat complicated (you must call the get() method) because instead of the actual link you get boost::reference_wrapper<T> .
For safe storage of pointers regarding memory, you can use boost::shared_ptr same way.
Diego sevilla
source share