added compiler case without unnamed template param. support

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5808 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-03-31 03:36:59 +00:00
commit 074a88fd37

View file

@ -403,19 +403,35 @@ static int NAME(TYPE x) {
%enddef
/* Auxiliary methods for assigning unnamed type C++ variables, where
/*
Auxiliary methods for assigning unnamed type C++ variables, where
swig doesn't know the casting type, but C++ can derived it:
struct Foo { enum {Hi, Hello } hola; };
Activate the following for compilers that do not support unnamed
template parameters (under your own risk).
#define SWIG_UNNAMED_USE_MEMCPY
*/
%insert("runtime") %{
#ifdef __cplusplus
/* here, the C++ compilers that do not accept unnamed template parameters */
#if defined(_SGI_COMPILER_VERSION)
#ifdef SWIG_UNNAMED_USE_MEMCPY
/* dangerous assigment, but for enums could work */
#define swig_assign_unnamed(eval, val) memcpy(&(eval),&(val), sizeof(eval))
#else
#define swig_assign_unnamed(eval, val) printf("unnamed member assigment not sopperted")
#endif
#else
template <class T, class V>
inline
void swig_assign_unnamed(T& eval, const V& val)
{
eval = static_cast<T>(val);
}
#endif
#else
#define swig_assign_unnamed(eval, val) eval = val
#endif