iris-ua / iris_lama

LaMa - A Localization and Mapping library
BSD 3-Clause "New" or "Revised" License
336 stars 72 forks source link

C++14 #20

Closed efernandez closed 4 years ago

efernandez commented 4 years ago

Use C++14. Some stuff didn't build for me with C++11 using g++ (Ubuntu 5.5.0-12ubuntu1~16.04) 5.5.0 20171010

On top of https://github.com/iris-ua/iris_lama/pull/19

eupedrosa commented 4 years ago

@efernandez, can you elaborate why changing from c++11 to c++14 on an older version of gcc makes your build successfull?

efernandez commented 4 years ago

can you elaborate why changing from c++11 to c++14 on an older version of gcc makes your build successfull?

I thought I did it because of that, but I just check it out again and that wasn't the reason. It built fine. Indeed it built fine w/o any changes. The Eigen alignment issues, for instance, happened on runtime.

The reason I switched to C++14 was in order to use auto in the lambda I use in https://github.com/iris-ua/iris_lama_ros/pull/13/files#diff-ac046ebae2c7cf0b88afc40e312bec36R91

Otherwise I get:

error: use of ‘auto’ in lambda parameter declaration only available with -std=c++14 or -std=gnu++14
                                  [](const auto& transform) { return transform.header.frame_id == "map"; }))

I could have changed that code an don't use auto, but I thought bumping things to C++14 wouldn't cause any harm, since most compilers already support it nowadays.

Sorry for not checking that out before.

eupedrosa commented 4 years ago

I think it is OK. I accept the PR because I also wanted to change to c++14. As I understood the main problem was with Eigen alignments. If for some reason I need to revert back to c++11 your buiild will be OK, right?

efernandez commented 4 years ago

If for some reason I need to revert back to c++11 your buiild will be OK, right?

Yes, it'd be ok. We'd only have to change https://github.com/iris-ua/iris_lama_ros/pull/13/files#diff-ac046ebae2c7cf0b88afc40e312bec36R91 so instead of const auto& transform it uses const geometry_msgs::TransformStamped& transform.