i am having some problem porting some template code from windows compiler to gcc
this is the function
Code:
template <class _T> inline impl::DeclaratorClass &BindBasicString(const std::string &_name)
{
return Class<_T>(_name)
.Constructor()
.Constructor<const _T&>() //line 65
.Method("clear", &_T::clear)
.Method("empty", &_T::empty)
.Method("size", &_T::size)
.Constructor<const _T::value_type*>()
.Constructor<const _T::value_type*, _T::size_type>()
.Constructor<const _T&, _T::size_type>()
.Constructor<const _T&, _T::size_type, _T::size_type>()
.Constructor<_T::size_type, _T::value_type>()
.Method("c_str", &_T::c_str)
.Method("push_back", &_T::push_back)
.Operator(Str, &_T::c_str)
.Operator(const_self + const_self)
.Operator(const_self == const_self)
.Operator(const_self == other<const _T::value_type*>())
.Operator(other<const _T::value_type*>() == const_self)
.Operator(impl::BinaryOperatorBaseHolder<ConCat, true, true, const _T>())
.Operator(impl::BinaryOperatorBaseHolder<ConCat, true, true, const _T::value_type*>())
.Operator(impl::BinaryOperatorBaseHolder<ConCat, true, false, const _T::value_type*>())
.Enum("npos", _T::npos);
}
.....
template<class _Class>
struct CustomClass : GenericClass
{
typedef CustomClass<_Class> Me;
.....
template<class _P1> inline Me &Constructor(const GenericMethodPolicy &_p = GenericMethodPolicy(0)) {
return InsertConstructor(new ConstructorClass1<_Class, _P1>(_p)), *this; };
};
The Constructor method below is what is called when .Constructor is called. Now you can download mluabind source code if you want to have a deeper look.
now the errors I get in gcc are as such
/usr/local/mluabind-0.05/impl/../impl/stl_basic_string.h: In function 'mluabind::impl:
eclaratorClass& mluabind::BindBasicString(const std::string&)':
/usr/local/mluabind-0.05/impl/../impl/stl_basic_string.h:65: error: expected primary-expression before 'const'
/usr/local/mluabind-0.05/impl/../impl/stl_basic_string.h:65: error: expected ';' before 'const'
/usr/local/mluabind-0.05/impl/../impl/stl_basic_string.h:65: error: expected unqualified-id before '>' token
/usr/local/mluabind-0.05/impl/../impl/stl_basic_string.h:65: error: expected initializer before '>' to
I am assuming gcc template programming is different. Can some understand and help me out with this !!!!