Skip to content

chore: replace deprecated range-v3 umbrella headers with specific component headers#517

Merged
evaleev merged 5 commits into
masterfrom
evaleev/cleanup/rangev3-includes
May 14, 2026
Merged

chore: replace deprecated range-v3 umbrella headers with specific component headers#517
evaleev merged 5 commits into
masterfrom
evaleev/cleanup/rangev3-includes

Conversation

@evaleev
Copy link
Copy Markdown
Member

@evaleev evaleev commented May 14, 2026

Summary

  • Replace <range/v3/{view,algorithm,action,iterator,all,functional,numeric}.hpp> umbrella includes with the specific <range/v3/<dir>/<name>.hpp> component headers actually used by each TU (IWYU). Also swap deprecated <range/v3/front.hpp> -> <range/v3/range/operations.hpp>.
  • In wick.hpp, swap ranges::span<size_t> -> std::span<size_t> to dodge a unity-build name collision: pulling <range/v3/view/span.hpp> made meta::_t (in span_view's body) ambiguous between ::meta and sequant::meta once another TU did using namespace sequant; at file scope.
  • Drop the unused OpSeq alias in the wick benchmark.
  • Fix two-phase dependent-member-template lookup in tests/integration/eval/calc_info.hpp (this->template node_<ExprT>(...)).

No behavioral changes beyond the ranges::span -> std::span swap (compatible — std::span is C++20, already used elsewhere, and ranges::any_of accepts it as a range).

Verified locally: full ninja build on cmake-build-debug (clang, libc++, asan) clean. ctest shows 240/246 pass; the 6 failures are pre-existing environmental issues (BTAS/TiledArray third-party unit-build collisions, Python+ASan dyld injection) unrelated to this PR.

Test plan

  • CI builds clean across configurations
  • ctest SeQuant unit + integration tests pass
  • Spot-check that downstream consumers (MPQC etc.) still build against this header surface

🤖 Generated with Claude Code

evaleev added 5 commits May 14, 2026 01:26
…ponent headers

Replaces `<range/v3/{view,algorithm,action,iterator,all,functional,
numeric}.hpp>` umbrella includes with the specific `<range/v3/<dir>/<name>.hpp>`
component headers actually used by each translation unit. Drops the umbrella
`<range/v3/front.hpp>` in favor of the recommended `<range/v3/range/operations.hpp>`
(`front.hpp` self-deprecates).

In `SeQuant/core/wick.hpp`, replaces `ranges::span<size_t>` with `std::span<size_t>`
(plus `#include <span>`): including `<range/v3/view/span.hpp>` triggered an
ambiguous-name lookup for `meta::_t` (between `::meta` from the meta library
and `sequant::meta` from `string.hpp`) in unity builds where another TU does
`using namespace sequant;` at file scope. `std::span` sidesteps the collision
and is C++20 so already available.

Other small touch-ups carried along with the include surgery:
- `SeQuant/core/algorithm.hpp` and `SeQuant/core/eval/eval_expr.cpp`:
  `ranges::views::transform` -> `std::views::transform` in two local lambdas
  (the umbrella `view.hpp` previously pulled `ranges::views::transform` in
  transitively; the slice-only include does not).
- `SeQuant/core/ranges.hpp`: `#include <numeric>` for `std::accumulate`.
- `SeQuant/core/utility/indices.hpp`: `#include <range/v3/range/operations.hpp>`
  for `ranges::at`.
- `tests/integration/eval/CMakeLists.txt` and
  `utilities/external-interface/CMakeLists.txt` keep their explicit
  `tiledarray` / `SeQuant::export` links ("link what you use") since those
  TUs directly consume headers from those modules.
The `NormalOperatorSequence` alias was never referenced inside
`get_op_sequence`.
`CalcInfo::nodes()` is a member template that calls `node_<ExprT>(...)`.
Strict two-phase lookup requires `this->template node_<ExprT>(...)` since
`node_` is a dependent member template; without it, clang treats `<` as a
less-than. Adds the necessary `this->template`.
Several headers and TUs were relying on transitive range-v3 includes
that exist via macOS clang+libc++ but not via Ubuntu g++14+libstdc++
(or via CI's macos-26 clang). Add the specific component headers each
file needs for the `ranges::xxx` / `ranges::views::xxx` APIs it uses.

No behavioral change.
… / Boost.Hana ADL

- df.cpp / thc.cpp: need <range/v3/range/operations.hpp> for ranges::front /
  ranges::back. Without it ADL latches onto boost::hana::front instead
  (visible on macos-26 clang Release).
- sum.cpp, scf_{btas,ta,tapp}.hpp: same — add <range/v3/range/operations.hpp>
  for ranges::front.
- ranges.hpp: add <algorithm> for std::find_if (gcc-14 didn't have it
  transitively).
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Mechanical IWYU-style cleanup that replaces deprecated range-v3 umbrella headers (<range/v3/all.hpp>, <range/v3/view.hpp>, <range/v3/algorithm.hpp>, etc.) with the specific per-component headers each TU actually uses, plus a small set of incidental fixes needed to keep the build clean.

Changes:

  • Across ~70 files, swap umbrella range-v3 includes for narrow component includes (and replace deprecated <range/v3/front.hpp> with <range/v3/range/operations.hpp>).
  • In SeQuant/core/wick.hpp, swap ranges::span<size_t>std::span<size_t> to avoid a unity-build ADL/meta::_t collision triggered by including <range/v3/view/span.hpp>; correspondingly add <span> and reorder/expand includes.
  • Two small correctness/cleanup fixes: tests/integration/eval/calc_info.hpp now uses this->template node_<ExprT>(...) for dependent-member-template lookup, and the unused OpSeq alias is removed from benchmarks/wick.cpp. Also switches a couple of using ranges::views::transform; to using std::views::transform; in SeQuant/core/algorithm.hpp and SeQuant/core/eval/eval_expr.cpp.

Reviewed changes

Copilot reviewed 100 out of 100 changed files in this pull request and generated no comments.

Show a summary per file
File Description
SeQuant/core/wick.hpp Add narrow range-v3 includes, <span>; swap ranges::spanstd::span to avoid unity-build name collision
SeQuant/core/wick.impl.hpp Replace umbrella headers with specific algorithm/view headers
SeQuant/core/algorithm.hpp Narrow include + switch transform to std::views::transform in inits
SeQuant/core/eval/eval_expr.cpp Narrow includes + switch transform to std::views::transform in imed_hashes
SeQuant/core/eval/eval.hpp, eval_node.hpp, eval_expr.hpp, cache_manager.{hpp,cpp}, result.hpp Narrow includes
SeQuant/core/eval/backends/{btas,tapp,tiledarray}/{eval_expr,result}.hpp Narrow includes
SeQuant/core/expressions/*.{hpp,cpp} (abstract_tensor, expr, expr_algorithms, product, sum, tensor) Narrow includes
SeQuant/core/tensor_network/{v1,v2,v3}.{hpp,cpp}, utils.hpp Narrow includes
SeQuant/core/{index,index_space_registry,hugenholtz,op,tensor_canonicalizer,binary_node,asy_cost,ranges}.{hpp,cpp} Narrow includes
SeQuant/core/optimize/{single_term.hpp,fusion.cpp,sum.cpp} Narrow includes
SeQuant/core/io/serialization/v1/{ast_conversions.hpp,serialize.cpp} Narrow includes / drop unused umbrella
SeQuant/core/export/{reordering_context.cpp,generation_optimizer.hpp} Narrow includes
SeQuant/core/utility/{indices.hpp,permutation.hpp,expr.{hpp,cpp}} Narrow includes
SeQuant/domain/mbpt/{op.{hpp,cpp,ipp},op_registry.hpp,context.cpp,biorthogonalization.{hpp,cpp},spin.{hpp,cpp},utils.{hpp,cpp},vac_av.hpp} Narrow includes
SeQuant/domain/mbpt/rules/{csv.cpp,df.cpp,thc.cpp} Narrow includes
tests/unit/*.cpp, catch2_sequant.hpp Narrow / drop umbrella includes
tests/integration/{eomcc,srcc}.cpp, eval/{options.{hpp,cpp},calc_info.hpp,eval_utils.hpp,{ta,tapp,btas}/{data_world_,scf_}.hpp} Narrow includes; calc_info.hpp adds this->template node_<ExprT>(...)
benchmarks/{tensor_network,wick}.cpp Narrow includes; remove unused OpSeq alias

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@evaleev evaleev merged commit df254b4 into master May 14, 2026
17 checks passed
@evaleev evaleev deleted the evaleev/cleanup/rangev3-includes branch May 14, 2026 22:16
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