boost::shared_ptr<Atom> atom = (*pCurrentROMol)[*atBegin]

should probably be:

boost::shared_ptr<Atom> atom((*pCurrentROMol)[*atBegin]);

Although I'm skeptical of the correctness of this code, because
ROMol::operator[] returns a pointer to an atom owned by the ROMol. If your
take ownership of the atom with a shared_ptr and then allow the shared_ptr
to clean it up you're asking for trouble. Maybe you were trying to copy the
atom, and control ownership with the shared_ptr?

- dan nealschneider

(né wandschneider)

Senior Developer
Schr*ö*dinger, Inc
Portland, OR




On Tue, Dec 11, 2018 at 3:36 PM Yingfeng Wang <[email protected]> wrote:

> I am using the C++ library of RDKit on Mac. My C++ code works with
> RDKit_2017_09_3. However, after I switch to RDKit 2018_03_4, I got the
> following error when compiling my C++ source code.
>
> *Database.cpp:148:33: **error: **no viable conversion from 'const
> RDKit::Atom *' to*
>
> *      'boost::shared_ptr<Atom>'*
>
>         boost::shared_ptr<Atom> atom = (*pCurrentROMol)[*atBegin];
>
> *                                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~*
>
> */usr/local/Cellar/boost/1.68.0/include/boost/smart_ptr/shared_ptr.hpp:358:21:
> **note: *
>
>       candidate constructor not viable: no known conversion from
>
>       'const RDKit::Atom *' to 'boost::detail::sp_nullptr_t' (aka
> 'nullptr_t')
>
>       for 1st argument
>
>     BOOST_CONSTEXPR shared_ptr( boost::detail::sp_nullptr_t )
> BOOST_SP_N...
>
> *                    ^*
>
> */usr/local/Cellar/boost/1.68.0/include/boost/smart_ptr/shared_ptr.hpp:422:5:
> **note: *
>
>       candidate constructor not viable: no known conversion from
>
>       'const RDKit::Atom *' to 'const boost::shared_ptr<RDKit::Atom> &'
> for 1st
>
>       argument
>
>     shared_ptr( shared_ptr const & r ) BOOST_SP_NOEXCEPT : px( r.px ),
> p...
>
> *    ^*
>
> I am using Clang on Mac. The version information is given as follows.
>
> g++ -v
>
> Configured with: --prefix=/Library/Developer/CommandLineTools/usr
> --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
>
> Apple LLVM version 10.0.0 (clang-1000.10.44.4)
>
> Target: x86_64-apple-darwin18.2.0
>
> Thread model: posix
>
> I notice that "Starting with the 2018_03 release, the RDKit core C++ code
> is written in modern C++; for this release that means C++11. "
>
> Actually, I also use -std=c++11 when compiling my C++ source code. I also
> tested RDKit 2018_09_1 and got the similar error. I am wondering how to fix
> this problem.
>
> Thanks.
>
> Yingfeng
>
>
> _______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to