diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2009-08-05 22:17:06 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2009-08-05 22:17:06 +0000 |
commit | 22c0b83cef8812fcf13b0021beaf1bd8ad090fec (patch) | |
tree | 58b9b86a6624ff43a080a57b25d1d5317cf5c6e5 /Lib/tcl | |
parent | b9ff3b0faeba2a7e607f25bc36509e3a86d2d154 (diff) | |
download | swig-22c0b83cef8812fcf13b0021beaf1bd8ad090fec.tar.gz |
fix vector of templated types
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11508 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib/tcl')
-rw-r--r-- | Lib/tcl/std_vector.i | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/Lib/tcl/std_vector.i b/Lib/tcl/std_vector.i index d913f00cc..273214292 100644 --- a/Lib/tcl/std_vector.i +++ b/Lib/tcl/std_vector.i @@ -16,17 +16,17 @@ // const declarations are used to guess the intent of the function being // exported; therefore, the following rationale is applied: // -// -- f(std::vector<T>), f(const std::vector<T>&), f(const std::vector<T>*): +// -- f(std::vector< T >), f(const std::vector< T >&), f(const std::vector< T >*): // the parameter being read-only, either a Tcl list or a -// previously wrapped std::vector<T> can be passed. -// -- f(std::vector<T>&), f(std::vector<T>*): +// previously wrapped std::vector< T > can be passed. +// -- f(std::vector< T >&), f(std::vector< T >*): // the parameter must be modified; therefore, only a wrapped std::vector // can be passed. -// -- std::vector<T> f(): +// -- std::vector< T > f(): // the vector is returned by copy; therefore, a Tcl list of T:s // is returned which is most easily used in other Tcl functions procs -// -- std::vector<T>& f(), std::vector<T>* f(), const std::vector<T>& f(), -// const std::vector<T>* f(): +// -- std::vector< T >& f(), std::vector< T >* f(), const std::vector< T >& f(), +// const std::vector< T >* f(): // the vector is returned by reference; therefore, a wrapped std::vector // is returned // ------------------------------------------------------------------------ @@ -85,7 +85,7 @@ int SwigDouble_As(Tcl_Interp *interp, Tcl_Obj *o, Type *val) { namespace std { template<class T> class vector { - %typemap(in) vector<T> (std::vector<T> *v) { + %typemap(in) vector< T > (std::vector< T > *v) { Tcl_Obj **listobjv; int nitems; int i; @@ -95,11 +95,11 @@ namespace std { $&1_descriptor, 0) == 0){ $1 = *v; } else { - // It isn't a vector<T> so it should be a list of T's + // It isn't a vector< T > so it should be a list of T's if(Tcl_ListObjGetElements(interp, $input, \ &nitems, &listobjv) == TCL_ERROR) return TCL_ERROR; - $1 = std::vector<T>(); + $1 = std::vector< T >(); for (i = 0; i < nitems; i++) { if ((SWIG_ConvertPtr(listobjv[i],(void **) &temp, $descriptor(T *),0)) != 0) { @@ -113,8 +113,8 @@ namespace std { } } - %typemap(in) const vector<T>* (std::vector<T> *v, std::vector<T> w), - const vector<T>& (std::vector<T> *v, std::vector<T> w) { + %typemap(in) const vector< T >* (std::vector< T > *v, std::vector< T > w), + const vector< T >& (std::vector< T > *v, std::vector< T > w) { Tcl_Obj **listobjv; int nitems; int i; @@ -124,11 +124,11 @@ namespace std { $&1_descriptor, 0) == 0) { $1 = v; } else { - // It isn't a vector<T> so it should be a list of T's + // It isn't a vector< T > so it should be a list of T's if(Tcl_ListObjGetElements(interp, $input, &nitems, &listobjv) == TCL_ERROR) return TCL_ERROR; - w = std::vector<T>(); + w = std::vector< T >(); for (i = 0; i < nitems; i++) { if ((SWIG_ConvertPtr(listobjv[i],(void **) &temp, $descriptor(T *),0)) != 0) { @@ -143,7 +143,7 @@ namespace std { } } - %typemap(out) vector<T> { + %typemap(out) vector< T > { for (unsigned int i=0; i<$1.size(); i++) { T* ptr = new T((($1_type &)$1)[i]); Tcl_ListObjAppendElement(interp, $result, \ @@ -153,18 +153,18 @@ namespace std { } } - %typecheck(SWIG_TYPECHECK_VECTOR) vector<T> { + %typecheck(SWIG_TYPECHECK_VECTOR) vector< T > { Tcl_Obj **listobjv; int nitems; T* temp; - std::vector<T> *v; + std::vector< T > *v; if(SWIG_ConvertPtr($input, (void **) &v, \ $&1_descriptor, 0) == 0) { /* wrapped vector */ $1 = 1; } else { - // It isn't a vector<T> so it should be a list of T's + // It isn't a vector< T > so it should be a list of T's if(Tcl_ListObjGetElements(interp, $input, &nitems, &listobjv) == TCL_ERROR) $1 = 0; @@ -181,19 +181,19 @@ namespace std { } } - %typecheck(SWIG_TYPECHECK_VECTOR) const vector<T>&, - const vector<T>* { + %typecheck(SWIG_TYPECHECK_VECTOR) const vector< T >&, + const vector< T >* { Tcl_Obj **listobjv; int nitems; T* temp; - std::vector<T> *v; + std::vector< T > *v; if(SWIG_ConvertPtr($input, (void **) &v, \ $1_descriptor, 0) == 0){ /* wrapped vector */ $1 = 1; } else { - // It isn't a vector<T> so it should be a list of T's + // It isn't a vector< T > so it should be a list of T's if(Tcl_ListObjGetElements(interp, $input, &nitems, &listobjv) == TCL_ERROR) $1 = 0; @@ -213,7 +213,7 @@ namespace std { public: vector(unsigned int size = 0); vector(unsigned int size, const T& value); - vector(const vector<T> &); + vector(const vector< T > &); unsigned int size() const; bool empty() const; @@ -251,9 +251,9 @@ namespace std { // specializations for built-ins %define specialize_std_vector(T, CONVERT_FROM, CONVERT_TO) - template<> class vector<T> { + template<> class vector< T > { - %typemap(in) vector<T> (std::vector<T> *v){ + %typemap(in) vector< T > (std::vector< T > *v){ Tcl_Obj **listobjv; int nitems; int i; @@ -263,11 +263,11 @@ namespace std { $&1_descriptor, 0) == 0) { $1 = *v; } else { - // It isn't a vector<T> so it should be a list of T's + // It isn't a vector< T > so it should be a list of T's if(Tcl_ListObjGetElements(interp, $input, &nitems, &listobjv) == TCL_ERROR) return TCL_ERROR; - $1 = std::vector<T>(); + $1 = std::vector< T >(); for (i = 0; i < nitems; i++) { if (CONVERT_FROM(interp, listobjv[i], &temp) == TCL_ERROR) return TCL_ERROR; @@ -276,8 +276,8 @@ namespace std { } } - %typemap(in) const vector<T>& (std::vector<T> *v,std::vector<T> w), - const vector<T>* (std::vector<T> *v,std::vector<T> w) { + %typemap(in) const vector< T >& (std::vector< T > *v,std::vector< T > w), + const vector< T >* (std::vector< T > *v,std::vector< T > w) { Tcl_Obj **listobjv; int nitems; int i; @@ -287,11 +287,11 @@ namespace std { $1_descriptor, 0) == 0) { $1 = v; } else { - // It isn't a vector<T> so it should be a list of T's + // It isn't a vector< T > so it should be a list of T's if(Tcl_ListObjGetElements(interp, $input, &nitems, &listobjv) == TCL_ERROR) return TCL_ERROR; - w = std::vector<T>(); + w = std::vector< T >(); for (i = 0; i < nitems; i++) { if (CONVERT_FROM(interp, listobjv[i], &temp) == TCL_ERROR) return TCL_ERROR; @@ -301,25 +301,25 @@ namespace std { } } - %typemap(out) vector<T> { + %typemap(out) vector< T > { for (unsigned int i=0; i<$1.size(); i++) { Tcl_ListObjAppendElement(interp, $result, \ CONVERT_TO((($1_type &)$1)[i])); } } - %typecheck(SWIG_TYPECHECK_VECTOR) vector<T> { + %typecheck(SWIG_TYPECHECK_VECTOR) vector< T > { Tcl_Obj **listobjv; int nitems; T temp; - std::vector<T> *v; + std::vector< T > *v; if(SWIG_ConvertPtr($input, (void **) &v, \ $&1_descriptor, 0) == 0){ /* wrapped vector */ $1 = 1; } else { - // It isn't a vector<T> so it should be a list of T's + // It isn't a vector< T > so it should be a list of T's if(Tcl_ListObjGetElements(interp, $input, &nitems, &listobjv) == TCL_ERROR) $1 = 0; @@ -334,19 +334,19 @@ namespace std { } } - %typecheck(SWIG_TYPECHECK_VECTOR) const vector<T>&, - const vector<T>*{ + %typecheck(SWIG_TYPECHECK_VECTOR) const vector< T >&, + const vector< T >*{ Tcl_Obj **listobjv; int nitems; T temp; - std::vector<T> *v; + std::vector< T > *v; if(SWIG_ConvertPtr($input, (void **) &v, \ $1_descriptor, 0) == 0){ /* wrapped vector */ $1 = 1; } else { - // It isn't a vector<T> so it should be a list of T's + // It isn't a vector< T > so it should be a list of T's if(Tcl_ListObjGetElements(interp, $input, &nitems, &listobjv) == TCL_ERROR) $1 = 0; @@ -364,7 +364,7 @@ namespace std { public: vector(unsigned int size = 0); vector(unsigned int size, const T& value); - vector(const vector<T> &); + vector(const vector< T > &); unsigned int size() const; bool empty() const; |