Allow std::set<> C# typemaps to work for non-nullable types too
Notably make them work for primitive types, such as "int". Doing this requires using "object" instead of the actual C# type of the variable to store the current value in the iterator, as we don't currently have a "csnullabletype" typemap that would expand to "T" for nullable types and "T?" for the other ones. This is a bit ugly, but it shouldn't matter much for the generated code and is already done in std::vector<> typemaps. Also add a simple unit test verifying the basic functionality for such vectors. Closes #1568.
This commit is contained in:
parent
53d75dc133
commit
28c6140c56
3 changed files with 15 additions and 2 deletions
|
|
@ -192,7 +192,7 @@ class set {
|
|||
private $csclassname collectionRef;
|
||||
private global::System.Collections.Generic.IList<$typemap(cstype, T)> ItemsCollection;
|
||||
private int currentIndex;
|
||||
private $typemap(cstype, T) currentObject;
|
||||
private object currentObject;
|
||||
private int currentSize;
|
||||
|
||||
public $csclassnameEnumerator($csclassname collection) {
|
||||
|
|
@ -212,7 +212,7 @@ class set {
|
|||
throw new global::System.InvalidOperationException("Enumeration finished.");
|
||||
if (currentObject == null)
|
||||
throw new global::System.InvalidOperationException("Collection modified.");
|
||||
return currentObject;
|
||||
return ($typemap(cstype, T))currentObject;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue