G
Giuseppe:G:
Hi, any idea on what is this code doing:
//=================================
1 #include <boost/scoped_ptr.hpp>
....
3 typedef std::vector<std::vector<pair<size_t, size_t> > > ParamsType;
5 /*
6 *Is the following a boost shared pointer to a "ParamsType" object?
7 */
8 shared_ptr<ParamsType>& params;
....
14 params.reset(new ParamsType(m_pred_map->size()));
15 for (size_t pid = 0; pid < m_pred_map->size(); ++pid) {
16 vector<pair<size_t, size_t> >& param = (*params)[pid]; // ??
...
}
//=================================
I have problems with lines 14 & 16. First of all, is ParamsType a vector
of vectors of pairs? Then I think params is a pointer to that. Then, we
probably instantiate a new ParamsType and let params point at it. Right?
But then, what's happening in line 16?
Thanks in advance
Giuseppe
//=================================
1 #include <boost/scoped_ptr.hpp>
....
3 typedef std::vector<std::vector<pair<size_t, size_t> > > ParamsType;
5 /*
6 *Is the following a boost shared pointer to a "ParamsType" object?
7 */
8 shared_ptr<ParamsType>& params;
....
14 params.reset(new ParamsType(m_pred_map->size()));
15 for (size_t pid = 0; pid < m_pred_map->size(); ++pid) {
16 vector<pair<size_t, size_t> >& param = (*params)[pid]; // ??
...
}
//=================================
I have problems with lines 14 & 16. First of all, is ParamsType a vector
of vectors of pairs? Then I think params is a pointer to that. Then, we
probably instantiate a new ParamsType and let params point at it. Right?
But then, what's happening in line 16?
Thanks in advance
Giuseppe