Skip to content

Make every header self-contained - #102

Open
susilehtola wants to merge 1 commit into
wavefunction91:masterfrom
susilehtola:fix/self-contained-headers
Open

Make every header self-contained#102
susilehtola wants to merge 1 commit into
wavefunction91:masterfrom
susilehtola:fix/self-contained-headers

Conversation

@susilehtola

Copy link
Copy Markdown
Collaborator

None of the library headers could be relied upon to compile on their own;
they worked only when something else had already pulled in the standard
headers they use. Compiling each non-data header in isolation produced
eight hard failures:

  • spherical_micro_batcher.hpp calls std::any_of, std::minmax_element,
    std::partition, std::sort, std::unique and std::set_union without
    .
  • product_quadrature.hpp declares std::unique_ptr members without
    , so the class had no members at all when compiled alone. This
    cascaded into spherical_quadrature.hpp, pruned_spherical_quadrature.hpp
    and the batcher.
  • util/create_array.hpp uses std::array and std::index_sequence,
    util/copy_grid.hpp uses std::copy, util/legendre.hpp uses size_t, and
    util/bound_transform.hpp uses assert and std::tuple, none of them
    declared.

Separately, was not included anywhere in the library, although
std::cos, std::sin, std::sqrt, std::pow, std::log and std::abs are used
throughout and M_PI appears in nine places. The two Newton solvers also
use std::numeric_limits and std::runtime_error without or
.

Add the includes each header actually needs. Also qualify the one
unqualified cos() call in gausslobatto.hpp: is not required to
place names in the global namespace, so it only resolved because <math.h>
happened to be reachable.

Every non-data header now compiles standalone.

Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01FDTFYJMQ76iujDFNHzZyXF

None of the library headers could be relied upon to compile on their own;
they worked only when something else had already pulled in the standard
headers they use. Compiling each non-data header in isolation produced
eight hard failures:

* spherical_micro_batcher.hpp calls std::any_of, std::minmax_element,
  std::partition, std::sort, std::unique and std::set_union without
  <algorithm>.
* product_quadrature.hpp declares std::unique_ptr members without
  <memory>, so the class had no members at all when compiled alone. This
  cascaded into spherical_quadrature.hpp, pruned_spherical_quadrature.hpp
  and the batcher.
* util/create_array.hpp uses std::array and std::index_sequence,
  util/copy_grid.hpp uses std::copy, util/legendre.hpp uses size_t, and
  util/bound_transform.hpp uses assert and std::tuple, none of them
  declared.

Separately, <cmath> was not included anywhere in the library, although
std::cos, std::sin, std::sqrt, std::pow, std::log and std::abs are used
throughout and M_PI appears in nine places. The two Newton solvers also
use std::numeric_limits and std::runtime_error without <limits> or
<stdexcept>.

Add the includes each header actually needs. Also qualify the one
unqualified cos() call in gausslobatto.hpp: <cmath> is not required to
place names in the global namespace, so it only resolved because <math.h>
happened to be reachable.

Every non-data header now compiles standalone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FDTFYJMQ76iujDFNHzZyXF
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.

1 participant