Alter-Native
Alter-Native copied to clipboard
Generic class in another class generates broken c++
Try this c# code
class Foo {
class Bar<T> { }
}
It will pretty much just go off the rails, generating the below code, which among other things, references type Bar which doesn't exist.
class Foo : public virtual Object{
public:
class Bar_T{
private:
template<typename T>
class Bar_T_Base : private virtual Object{
public:
Bar::Bar_Base(){
}
};
private:
template<typename T, bool>
class Bar_T {
};
private:
//Basic types template type
template<typename T>
class Bar_T<T, true> : private Bar_T_Base<T>{
};
private:
//Generic template type
template<typename T>
class Bar_T<T, false> : private virtual Bar_T_Base<Object>{
};
};
};
I tried a non-generic nested type and it worked OK