Skip to content

Fix namespace pollution that causes boost.geometry errors in boost 1.74

Dave Moxey requested to merge dmoxey/nektar:fix/namespace-pollution into master

Issue/feature addressed

Fixes namespace pollution that causes compilation to fail on newer compilers with boost 1.74+, in particular errors such as:

In file included from /usr/include/boost/geometry/strategies/geographic/distance.hpp:38,
                 from /usr/include/boost/geometry/strategies/strategies.hpp:113,
                 from /root/nektar/library/LibUtilities/BasicUtils/Interpolator.h:47,
                 from /root/nektar/library/FieldUtils/Interpolator.h:40,
                 from /root/nektar/library/SolverUtils/Core/Coupling.h:36,
                 from /root/nektar/solvers/AcousticSolver/EquationSystems/AcousticSystem.h:50:
/usr/include/boost/geometry/geometries/point_xy.hpp: In member function 'void boost::geometry::model::d2::point_xy<CoordinateType, CoordinateSystem>::x(const CoordinateType&)':
/usr/include/boost/geometry/geometries/point_xy.hpp:74:27: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Key, class _Compare, class _Alloc> class std::set'
   74 |     { this->template set<0>(v); }
      |                           ^
/usr/include/boost/geometry/geometries/point_xy.hpp:74:27: note:   expected a type, got '0'
/usr/include/boost/geometry/geometries/point_xy.hpp:74:27: error: template argument 2 is invalid
/usr/include/boost/geometry/geometries/point_xy.hpp:74:27: error: template argument 3 is invalid
/usr/include/boost/geometry/geometries/point_xy.hpp: In member function 'void boost::geometry::model::d2::point_xy<CoordinateType, CoordinateSystem>::y(const CoordinateType&)':
/usr/include/boost/geometry/geometries/point_xy.hpp:78:27: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Key, class _Compare, class _Alloc> class std::set'
   78 |     { this->template set<1>(v); }
      |                           ^
/usr/include/boost/geometry/geometries/point_xy.hpp:78:27: note:   expected a type, got '1'
/usr/include/boost/geometry/geometries/point_xy.hpp:78:27: error: template argument 2 is invalid
/usr/include/boost/geometry/geometries/point_xy.hpp:78:27: error: template argument 3 is invalid

Proposed solution

This is caused by an errant using namespace std inside Advection.h, which causes confusion between the boost geometry set and std::set.

Implementation

n/a

Tests

CI currently doesn't have new enough environments (e.g. Debian unstable) to detect this.

Notes

n/a

Checklist

  • Changelog is updated.
  • Contributed code is correctly formatted. (See the contributing guidelines).
  • No extraneous files have been added (e.g. compiler output or test data files).

Warning

On the 19.07 the code formatting (code style) was standardised using clang-format, over the whole Nektar++ code. This means changes in your branch will conflict with formatting changes on the master branch. To resolve these conflicts , see #295 (closed)

Merge request reports