mirror of
https://github.com/topjohnwu/cxx.git
synced 2025-02-23 09:30:45 +00:00
Merge pull request #556 from dtolnay/functional
Include <functional> when deriving Hash impl shim
This commit is contained in:
commit
e5ea14e049
@ -27,6 +27,7 @@ pub struct Includes<'a> {
|
||||
pub cstdint: bool,
|
||||
pub cstring: bool,
|
||||
pub exception: bool,
|
||||
pub functional: bool,
|
||||
pub initializer_list: bool,
|
||||
pub iterator: bool,
|
||||
pub memory: bool,
|
||||
@ -77,6 +78,7 @@ pub(super) fn write(out: &mut OutFile) {
|
||||
cstdint,
|
||||
cstring,
|
||||
exception,
|
||||
functional,
|
||||
initializer_list,
|
||||
iterator,
|
||||
memory,
|
||||
@ -107,6 +109,9 @@ pub(super) fn write(out: &mut OutFile) {
|
||||
if exception {
|
||||
writeln!(out, "#include <exception>");
|
||||
}
|
||||
if functional {
|
||||
writeln!(out, "#include <functional>");
|
||||
}
|
||||
if initializer_list {
|
||||
writeln!(out, "#include <initializer_list>");
|
||||
}
|
||||
|
@ -158,6 +158,7 @@ fn write_std_specializations(out: &mut OutFile, apis: &[Api]) {
|
||||
if let Api::Struct(strct) = api {
|
||||
if derive::contains(&strct.derives, Trait::Hash) {
|
||||
out.next_section();
|
||||
out.include.functional = true;
|
||||
let qualified = strct.name.to_fully_qualified();
|
||||
writeln!(out, "template <> struct hash<{}> {{", qualified);
|
||||
writeln!(
|
||||
|
Loading…
x
Reference in New Issue
Block a user