fixes for noconst types and size_t

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6417 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-10-18 00:20:00 +00:00
commit c2f549b73b

View file

@ -28,15 +28,20 @@
%} %}
%apply size_t { std::size_t };
%apply const size_t& { const std::size_t& };
%apply ptrdiff_t { std::ptrdiff_t }
%apply const ptrdiff_t& { const std::ptrdiff_t& }
%fragment("StdTraitsCommon","header") %fragment("StdTraitsCommon","header")
%{ %{
namespace swig { namespace swig {
template <class Type>
struct noconst_traits {
typedef Type noconst_type;
};
template <class Type>
struct noconst_traits<const Type> {
typedef Type noconst_type;
};
/* /*
type categories type categories
*/ */
@ -50,7 +55,7 @@ namespace swig {
template <class Type> template <class Type>
inline const char* type_name() { inline const char* type_name() {
return traits<Type>::type_name(); return traits<typename noconst_traits<Type >::noconst_type >::type_name();
} }
template <class Type> template <class Type>
@ -86,16 +91,6 @@ namespace swig {
} }
}; };
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, class Category> template <class Type, class Category>
struct traits_as { }; struct traits_as { };