Fix #1251 three parameter equality operator#1776
Conversation
- Operators in generic classes do not attempt to generate as extension methods anymore - Empty `...Extensions` classes are no longer generated - `string` as a template argument is correctly cast - `MarshalCharAsManagedChar` option also generates correct casts - Suppress warning regarding returning struct field by ref - Eliminate some tabs that snuck into the test C++ header
|
Fixes #1251 |
Do you mean force the symbols to get exported in the shared library? If so, you can see how we do it in https://github.com/mono/CppSharp/blob/main/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std-symbols.cpp. There are some other techniques we use for forcing constructors to get exported for instance. There is a flag to do it at the compiler level but Clang (and maybe GCC) for instance just ignores it and does nothing with it, so nothing reliable we can use.
Dunno, I guess it's fine to add a new helper. Just wondering about the name, should it be The only other thing that comes to mind is maybe use it recursively: public static bool IsTemplateParameterType(this Type type)
{
if (type is TemplateParameterType or TemplateParameterSubstitutionType)
return true;
var ptr = type;
while (ptr is PointerType pType)
{
ptr = pType.Pointee;
if (ptr.IsTemplateParameterType(ptr))
return true;
}
return false;
} |
|
You may be able to simplify it further with |
I don't think that is what I mean. If I try to do explicit template instantiation ( Either way, if this turns out to be a bug/missing feature I think it's preferable to just open an issue and deal with it later, the method should be fine for now.
Yep! I wasn't happy with the name either, this fits much better.
Very helpful! The code is much cleaner now! |
...Extensionsclasses are no longer generatedstringas a template argument is correctly castMarshalCharAsManagedCharoption also generates correct castsConsiderations:
IsTemplateextension method is entirely correct or if the same functionality might exist someplace else.