Dear Evgueni,
On Fri, Feb 5, 2010 at 11:21 AM, Evgueni Kolossov <[email protected]> wrote:
> Dear Greg,
>
> Thank you very much for quick answer.
> I think the problem is in the copying from one vector to another:
> for (unsigned int i=9; i < m_vF.size(); i++)
> vNew.push_back(m_vF[i]);
>
> Can this corrupt the content of new vector?
The boost smart pointers can be copied without problems, so this
shouldn't cause any corruption. Building on the small example I was
doing before, the following works without problems:
{
RWMol *m=new RWMol();
m->addAtom(new Atom(6));
m->addAtom(new Atom(6));
m->addBond(0,1,Bond::SINGLE);
ROMOL_SPTR msp((ROMol *)m);
RDKit::MOL_SPTR_VECT m_vF;
m_vF.push_back(msp);
ROMol *nm = new ROMol(*m_vF[0]);
m_vF.push_back(ROMOL_SPTR(nm));
RDKit::MOL_SPTR_VECT m_vF2;
m_vF2.resize(m_vF.size());
std::copy(m_vF.begin(),m_vF.end(),m_vF2.begin());
std::cerr<<m_vF2[0]->getNumAtoms()<<std::endl;
}
The original error you saw, from here:
> T * operator-> () const
> {
> BOOST_ASSERT(px != 0);
> return px;
> }
is triggered when you try to dereference a smart pointer that has a
null pointer as its contents. I'd suggest being sure that your
original vector doesn't have any empty elements (cases where the
molecule was a null pointer).
-greg
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss