Include <cstddef> for size_t
diff --git a/gen/include.rs b/gen/include.rs
index 7bec492..e3a9dd7 100644
--- a/gen/include.rs
+++ b/gen/include.rs
@@ -30,6 +30,7 @@
pub struct Includes {
custom: Vec<String>,
pub array: bool,
+ pub cstddef: bool,
pub cstdint: bool,
pub cstring: bool,
pub exception: bool,
@@ -63,6 +64,9 @@
if self.array {
writeln!(f, "#include <array>")?;
}
+ if self.cstddef {
+ writeln!(f, "#include <cstddef>")?;
+ }
if self.cstdint {
writeln!(f, "#include <cstdint>")?;
}
diff --git a/gen/write.rs b/gen/write.rs
index f0c9077..a4e2eb2 100644
--- a/gen/write.rs
+++ b/gen/write.rs
@@ -91,10 +91,11 @@
for ty in types {
match ty {
Type::Ident(ident) => match Atom::from(ident) {
- Some(U8) | Some(U16) | Some(U32) | Some(U64) | Some(Usize) | Some(I8)
- | Some(I16) | Some(I32) | Some(I64) | Some(Isize) => out.include.cstdint = true,
+ Some(U8) | Some(U16) | Some(U32) | Some(U64) | Some(I8) | Some(I16) | Some(I32)
+ | Some(I64) => out.include.cstdint = true,
+ Some(Usize) => out.include.cstddef = true,
Some(CxxString) => out.include.string = true,
- Some(Bool) | Some(F32) | Some(F64) | Some(RustString) | None => {}
+ Some(Bool) | Some(Isize) | Some(F32) | Some(F64) | Some(RustString) | None => {}
},
Type::RustBox(_) => out.include.type_traits = true,
Type::UniquePtr(_) => out.include.memory = true,
diff --git a/include/cxx.h b/include/cxx.h
index 1026743..50f8f69 100644
--- a/include/cxx.h
+++ b/include/cxx.h
@@ -1,5 +1,6 @@
#pragma once
#include <array>
+#include <cstddef>
#include <cstdint>
#include <exception>
#include <iosfwd>