chore: replace deprecated range-v3 umbrella headers with specific component headers#517
Merged
Merged
Conversation
…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).
Contributor
There was a problem hiding this comment.
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, swapranges::span<size_t>→std::span<size_t>to avoid a unity-build ADL/meta::_tcollision 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.hppnow usesthis->template node_<ExprT>(...)for dependent-member-template lookup, and the unusedOpSeqalias is removed frombenchmarks/wick.cpp. Also switches a couple ofusing ranges::views::transform;tousing std::views::transform;inSeQuant/core/algorithm.hppandSeQuant/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::span → std::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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<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>.wick.hpp, swapranges::span<size_t>->std::span<size_t>to dodge a unity-build name collision: pulling<range/v3/view/span.hpp>mademeta::_t(in span_view's body) ambiguous between::metaandsequant::metaonce another TU didusing namespace sequant;at file scope.OpSeqalias in the wick benchmark.tests/integration/eval/calc_info.hpp(this->template node_<ExprT>(...)).No behavioral changes beyond the
ranges::span->std::spanswap (compatible —std::spanis C++20, already used elsewhere, andranges::any_ofaccepts it as a range).Verified locally: full
ninjabuild oncmake-build-debug(clang, libc++, asan) clean.ctestshows 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
ctestSeQuant unit + integration tests pass🤖 Generated with Claude Code