UDST / pandana

Pandas Network Analysis by UrbanSim: fast accessibility metrics and shortest paths, using contraction hierarchies :world_map:
http://udst.github.io/pandana
GNU Affero General Public License v3.0
386 stars 84 forks source link

Adding "#include <functional>" to fix compilation on certain platforms #119

Closed smmaurer closed 5 years ago

smmaurer commented 5 years ago

It seems like certain C++ compilers require us to import the <functional> library in accessibility.cpp.

Not including it leads to errors like this:

src/accessibility.cpp:352:10: error: 'function' is not a member of 'std'
    std::function<double(const double &, const float &, const float &)> sum_function;
         ^~~~~~~~

This came up in one of the conda-forge Linux builds and is currently fixed with a patch in the build recipe: https://github.com/conda-forge/pandana-feedstock/pull/1/commits/fa91ad4fe6ed30febbb28bb6fb011d24d7e776c7

The conda-forge Windows 2.7 build is currently blocked with a similar looking error, so I'm hoping that fixing this in the source code will allow it to work. (More info about that in this un-merged PR: https://github.com/conda-forge/pandana-feedstock/pull/3.)

Plan

I think we should probably merge this directly into master and release it as v0.4.3. Adding the import statement does not affect compilation on platforms where it was already working -- at least not on my Mac or on the Travis Ubuntu images.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 91.667% when pulling 3cace5ca3ff12e251be0d6dfb5a5fb78d9df1931 on include-functional into 946da88bf4c1d2df8c7093167c5d56c3d4a52324 on master.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 91.667% when pulling 125eebdcad39f16e6157b9500efe1fa1578e6478 on include-functional into 946da88bf4c1d2df8c7093167c5d56c3d4a52324 on master.

federicofernandez commented 5 years ago

Good plan. And yes, sometimes it happens that different compilers using different versions of the standard library will requiere additional headers.