[clang-tools-extra] [clang-tidy] Add modernize-use-from-range-container-constructor check (PR #180868)
Victor Vianna via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 12 02:08:37 PST 2026
victorvianna wrote:
> But I'm not sure if std::ranges::to should be the default fix-it for containers with/without from_range_t.
@zwuis
Hm, the std::from_range version feels a bit more concise and easier to read due to less nested "<>". But yeah, in terms of simplifying the check logic, always using std::ranges::to<> would be the simplest. Is there a mailing list where we can ask for feedback?
// variable declarations
auto m = std::ranges::to<std::unordered_map<std::string, int>>(v);
std::unordered_map<std::string, int> m(std::from_range, v);
// other expressions
return std::ranges::to<std::unordered_map<std::string, int>>>(v);
return std::unordered_map<std::string, int>(std::from_range, v);
https://github.com/llvm/llvm-project/pull/180868
More information about the cfe-commits
mailing list