added support for const, like std::pair<const int, int>
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5815 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
be560544f5
commit
0c8f4b34bf
2 changed files with 37 additions and 16 deletions
|
|
@ -158,6 +158,19 @@ namespace swigpy {
|
|||
return traits_asptr<Type>::asptr(obj, vptr);
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
struct noconst_traits
|
||||
{
|
||||
typedef Type noconst_type;
|
||||
};
|
||||
|
||||
|
||||
template <class Type>
|
||||
struct noconst_traits<const Type>
|
||||
{
|
||||
typedef Type noconst_type;
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_asval
|
||||
{
|
||||
|
|
@ -167,7 +180,8 @@ namespace swigpy {
|
|||
value_type *p = 0;
|
||||
int res = asptr(obj, &p);
|
||||
if (res && p) {
|
||||
*val = *p;
|
||||
typedef typename noconst_traits<Type>::noconst_type noconst_type;
|
||||
*((noconst_type*)(val)) = *p;
|
||||
if (res == SWIG_NEWOBJ) delete p;
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue