Moved initialization of static class members outside of the class

declaration for template_typedef.i, template_typedef_cplx.i and
template_typedef_cplx2.h. GCC used to be more lenient about this
rule breakage, but gcc-3.2.2 shows no mercy.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4822 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Logan Johnson 2003-05-23 02:35:14 +00:00
commit 21cbcec55d
3 changed files with 81 additions and 26 deletions

View file

@ -70,8 +70,8 @@
typedef float argument_type;
typedef float result_type;
static const char* const arg_type = "float";
static const char* const res_type = "float";
static const char* const arg_type;
static const char* const res_type;
};
template<>
@ -80,8 +80,8 @@
typedef real argument_type;
typedef real result_type;
static const char* const arg_type = "real";
static const char* const res_type = "real";
static const char* const arg_type;
static const char* const res_type;
};
template<>
@ -89,8 +89,8 @@
{
typedef float argument_type;
typedef real result_type;
static const char* const arg_type = "float";
static const char* const res_type = "real";
static const char* const arg_type;
static const char* const res_type;
};
template<>
@ -98,8 +98,8 @@
{
typedef float argument_type;
typedef real result_type;
static const char* const arg_type = "float";
static const char* const res_type = "real";
static const char* const arg_type;
static const char* const res_type;
};
template <class AF, class RF, class AG, class RG>
@ -114,8 +114,25 @@
typename arith_traits< RF, RG >::result_type>();
}
#ifndef SWIG
// Initialize these static class members
const char* const arith_traits< float, float >::arg_type = "float";
const char* const arith_traits< float, float >::res_type = "float";
const char* const arith_traits< real, real >::arg_type = "real";
const char* const arith_traits< real, real >::res_type = "real";
const char* const arith_traits< real, float >::arg_type = "float";
const char* const arith_traits< real, float >::res_type = "real";
const char* const arith_traits< float, real >::arg_type = "float";
const char* const arith_traits< float, real >::res_type = "real";
#endif
}
%}
namespace vfncs {

View file

@ -73,8 +73,8 @@ typedef std::complex<double> cmplx;
typedef double argument_type;
typedef double result_type;
static const char* const arg_type = "double";
static const char* const res_type = "double";
static const char* const arg_type;
static const char* const res_type;
};
template<>
@ -83,8 +83,8 @@ typedef std::complex<double> cmplx;
typedef Complex argument_type;
typedef Complex result_type;
static const char* const arg_type = "complex";
static const char* const res_type = "complex";
static const char* const arg_type;
static const char* const res_type;
};
template<>
@ -92,8 +92,8 @@ typedef std::complex<double> cmplx;
{
typedef double argument_type;
typedef Complex result_type;
static const char* const arg_type = "double";
static const char* const res_type = "complex";
static const char* const arg_type;
static const char* const res_type;
};
template<>
@ -101,8 +101,8 @@ typedef std::complex<double> cmplx;
{
typedef double argument_type;
typedef Complex result_type;
static const char* const arg_type = "double";
static const char* const res_type = "complex";
static const char* const arg_type;
static const char* const res_type;
};
template <class AF, class RF, class AG, class RG>
@ -116,6 +116,25 @@ typedef std::complex<double> cmplx;
ArithUnaryFunction<typename arith_traits< AF, AG >::argument_type,
typename arith_traits< RF, RG >::result_type>();
}
#ifndef SWIG
// Initialize these static class members
const char* const arith_traits< double, double >::arg_type = "double";
const char* const arith_traits< double, double >::res_type = "double";
const char* const arith_traits< Complex, Complex >::arg_type = "complex";
const char* const arith_traits< Complex, Complex >::res_type = "complex";
const char* const arith_traits< Complex, double>::arg_type = "double";
const char* const arith_traits< Complex, double >::res_type = "complex";
const char* const arith_traits< double, Complex >::arg_type = "double";
const char* const arith_traits< double, Complex >::res_type = "complex";
#endif
}
%}

View file

@ -66,8 +66,8 @@ namespace vfncs {
{
typedef double argument_type;
typedef double result_type;
static const char* const arg_type = "double";
static const char* const res_type = "double";
static const char* const arg_type;
static const char* const res_type;
};
template<>
@ -76,8 +76,8 @@ namespace vfncs {
typedef Complex argument_type;
typedef Complex result_type;
static const char* const arg_type = "complex";
static const char* const res_type = "complex";
static const char* const arg_type;
static const char* const res_type;
};
template<>
@ -85,8 +85,8 @@ namespace vfncs {
{
typedef double argument_type;
typedef Complex result_type;
static const char* const arg_type = "double";
static const char* const res_type = "complex";
static const char* const arg_type;
static const char* const res_type;
};
template<>
@ -94,8 +94,8 @@ namespace vfncs {
{
typedef double argument_type;
typedef Complex result_type;
static const char* const arg_type = "double";
static const char* const res_type = "complex";
static const char* const arg_type;
static const char* const res_type;
};
template <class AF, class RF, class AG, class RG>
@ -109,7 +109,26 @@ namespace vfncs {
ArithUnaryFunction<typename arith_traits< AF, AG >::argument_type,
typename arith_traits< RF, RG >::result_type>();
}
}
#ifndef SWIG
// Initialize these static class members
const char* const arith_traits< double, double >::arg_type = "double";
const char* const arith_traits< double, double >::res_type = "double";
const char* const arith_traits< Complex, Complex >::arg_type = "complex";
const char* const arith_traits< Complex, Complex >::res_type = "complex";
const char* const arith_traits< Complex, double >::arg_type = "double";
const char* const arith_traits< Complex, double >::res_type = "complex";
const char* const arith_traits< double, Complex >::arg_type = "double";
const char* const arith_traits< double, Complex >::res_type = "complex";
#endif
} // end namespace vfncs
#ifdef SWIG