Browse Source

Added std::char_traits as a supported type because std::string needs it.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/787/head
Dimitar Dobrev 9 years ago
parent
commit
f7e5d9cc0e
  1. 2
      src/Generator/Passes/MarkSupportedClassTemplateSpecializationsPass.cs
  2. 7
      src/Generator/Passes/StripUnusedSystemTypesPass.cs

2
src/Generator/Passes/MarkSupportedClassTemplateSpecializationsPass.cs

@ -58,6 +58,6 @@ namespace CppSharp.Passes @@ -58,6 +58,6 @@ namespace CppSharp.Passes
}
}
private static string[] supportedStdTypes = { "basic_string", "allocator" };
private static string[] supportedStdTypes = { "basic_string", "allocator", "char_traits" };
}
}

7
src/Generator/Passes/StripUnusedSystemTypesPass.cs

@ -24,9 +24,10 @@ namespace CppSharp.Passes @@ -24,9 +24,10 @@ namespace CppSharp.Passes
public override bool VisitASTContext(ASTContext context)
{
// we need this one for marshalling std::string
foreach (var allocator in context.FindClass("allocator", false, true).Where(
a => a.TranslationUnit.IsSystemHeader))
usedStdTypes.Add(allocator);
foreach (var name in new[] { "allocator", "char_traits" })
foreach (var usedStdType in context.FindClass(name, false, true).Where(
a => a.TranslationUnit.IsSystemHeader))
usedStdTypes.Add(usedStdType);
var result = base.VisitASTContext(context);

Loading…
Cancel
Save