Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid rvalue reference and move for compatibility (#61) #62

Merged
merged 1 commit into from
Apr 24, 2020
Merged

Avoid rvalue reference and move for compatibility (#61) #62

merged 1 commit into from
Apr 24, 2020

Conversation

e-kwsm
Copy link
Contributor

@e-kwsm e-kwsm commented Apr 23, 2020

#61 2b364d9 breaks compatibility, leading to compilation failure of Open Babel:

../src/formats/maeformat.cpp: In member function ‘virtual bool OpenBabel::MAEFormat::WriteMolecule(OpenBabel::OBBase*, OpenBabel::OBConversion*)’:
../src/formats/maeformat.cpp:332:49: error: cannot bind rvalue reference of type ‘std::shared_ptr<schrodinger::mae::IndexedBlock>&&’ to lvalue of type ‘std::shared_ptr<schrodinger::mae::IndexedBlock>’
     ibm->addIndexedBlock(atom_block->getName(), atom_block);
                                                 ^~~~~~~~~~
In file included from ../external/maeparser-master/maeparser/Reader.hpp:8,
                 from ../src/formats/maeformat.cpp:33:
../external/maeparser-master/maeparser/MaeBlock.hpp:72:10: note:   initializing argument 2 of ‘void schrodinger::mae::IndexedBlockMap::addIndexedBlock(const string&, std::shared_ptr<schrodinger::mae::IndexedBlock>&&)’
     void addIndexedBlock(const std::string& name,
          ^~~~~~~~~~~~~~~
../src/formats/maeformat.cpp:333:49: error: cannot bind rvalue reference of type ‘std::shared_ptr<schrodinger::mae::IndexedBlock>&&’ to lvalue of type ‘std::shared_ptr<schrodinger::mae::IndexedBlock>’
     ibm->addIndexedBlock(bond_block->getName(), bond_block);
                                                 ^~~~~~~~~~
In file included from ../external/maeparser-master/maeparser/Reader.hpp:8,
                 from ../src/formats/maeformat.cpp:33:
../external/maeparser-master/maeparser/MaeBlock.hpp:72:10: note:   initializing argument 2 of ‘void schrodinger::mae::IndexedBlockMap::addIndexedBlock(const string&, std::shared_ptr<schrodinger::mae::IndexedBlock>&&)’
     void addIndexedBlock(const std::string& name,
          ^~~~~~~~~~~~~~~

To fix this, const reference pass by value and use move instead of rvalue reference.

@d-b-w
Copy link
Collaborator

d-b-w commented Apr 23, 2020

NBD, but I think that these should at least be by value, so that they are moved if possible.

@d-b-w d-b-w merged commit 439ba97 into schrodinger:master Apr 24, 2020
@d-b-w
Copy link
Collaborator

d-b-w commented Apr 24, 2020

Thanks for this!

@e-kwsm e-kwsm deleted the prepend-rvalue-reference branch April 24, 2020 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants