Fix SWIG_STD_VECTOR_ENHANCED macro used in C# std::vector to work with commas

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12081 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-06-01 23:10:22 +00:00
commit d25121a0ed
5 changed files with 50 additions and 6 deletions

View file

@ -0,0 +1,31 @@
using System;
using li_std_combinationsNamespace;
public class li_std_combinations_runme {
public static void Main() {
VectorPairIntString vpis = new VectorPairIntString();
vpis.Add(new PairIntString(123, "one hundred and twenty three"));
VectorString vs = new VectorString();
vs.Add("hi");
PairIntVectorString pivs = new PairIntVectorString(456, vs);
if (pivs.second[0] != "hi")
throw new ApplicationException("PairIntVectorString");
VectorVectorString vvs = new VectorVectorString();
vvs.Add(vs);
PairIntPairIntString pipis = new PairIntPairIntString(12, new PairIntString(3, "4"));
if (pipis.first != 12)
throw new ApplicationException("PairIntPairIntString");
PairDoubleString pds = new PairDoubleString(12.34, "okay");
VectorPairDoubleString vpds = new VectorPairDoubleString();
vpds.Add(pds);
// Check SWIG_STD_VECTOR_ENHANCED macro - it provides the Contains method
if (!vpds.Contains(pds))
throw new ApplicationException("VectorPairDoubleString");
}
}

View file

@ -13,3 +13,11 @@
%template(VectorVectorString) std::vector< std::vector<std::string> >;
%template(PairIntPairIntString) std::pair< int, std::pair<int, std::string> >;
#if defined(SWIGCSHARP)
// Checks macro containing a type with a comma
SWIG_STD_VECTOR_ENHANCED(std::pair< double, std::string >)
#endif
%template(PairDoubleString) std::pair< double, std::string >;
%template(VectorPairDoubleString) std::vector< std::pair<double, std::string> >;