Skip to content

Commit

Permalink
Merge pull request #1442 from atetubou/add_ranges_include
Browse files Browse the repository at this point in the history
Include <ranges> for std::ranges::contiguous_range
  • Loading branch information
dtolnay authored Feb 19, 2025
2 parents fb8fdc0 + 6ee5d40 commit 0243229
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions gen/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ pub(super) fn write(out: &mut OutFile) {
include.cstddef = true;
include.cstdint = true;
include.iterator = true;
include.ranges = true;
include.stdexcept = true;
include.type_traits = true;
builtin.friend_impl = true;
Expand Down
7 changes: 7 additions & 0 deletions gen/src/include.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub(crate) struct Includes<'a> {
pub iterator: bool,
pub memory: bool,
pub new: bool,
pub ranges: bool,
pub stdexcept: bool,
pub string: bool,
pub type_traits: bool,
Expand Down Expand Up @@ -94,6 +95,7 @@ pub(super) fn write(out: &mut OutFile) {
iterator,
memory,
new,
ranges,
stdexcept,
string,
type_traits,
Expand Down Expand Up @@ -155,6 +157,11 @@ pub(super) fn write(out: &mut OutFile) {
if vector && !cxx_header {
writeln!(out, "#include <vector>");
}
if ranges {
writeln!(out, "#if __cplusplus >= 202002L");
writeln!(out, "#include <ranges>");
writeln!(out, "#endif");
}
if basetsd && !cxx_header {
writeln!(out, "#if defined(_WIN32)");
writeln!(out, "#include <basetsd.h>");
Expand Down

0 comments on commit 0243229

Please sign in to comment.