[gameprogrammer] Re: What do I need to download develop a client/server java applet?

Hi Scott,

C++ template's syntax is very dark and complicated, sometimes confussing. An
example:

// definition
template<typename T>
class CConnection
{
    public:
        void DoSomething();
};

// implementation
template<typename T>
void CConnection<T>::DoSomething()
{
}

And if you use a template as a return type or use template methods within a
template class, things goes complicated:

template<typename T>
class CConnection
{
    public:
        template<typename TAnother>
        void DoSomething();
};

template<typename T, typename TAnother>
void CConnection<T>::DoSomething<TAnother>()
{
}

And what if you wanna use templates within templates? Things gets more
confussing.

template<typename T>
class CConnection { ... };

template<typename T>
class CAdapter { ... };

template<typename T>
class CReader { ... };

template<template class Connection<>, template class Adapter<>, template
class Reader<> > //watchout with the speces between > !
class Database { ... };

Thus it can be avoided by using something like:

template<typename T>
struct DBTemplates
{
typedef CConnection<T> _Connection;
typedef CAdapter<T> _Adapter;
typedef CReader<T> _Reader;
}

template<typename T>
class Database { ... }:

And when within Database I need to access a CConnection<>, I'll do something
like:

typename T::_Connection objConnection;

And then our Database template instantiation should look like:

typedef DBTemplates<SomeClass> DBSomeClassTemplates;
Database<DBSomeClassTemplates> objDBase;

These were some examples on why it is so horrible template syntax...

Regards,
Fernando.

On 22 Jul, 2005, at 12:50 PM, Fernando Arturo Gómez Flores wrote:
> Well, this is great for Java. However, its a pity that they decided to
> employ the same horrible sintax as in C++...

You'll have to forgive me -- I'm a question guy:

So what's so horrible about this syntax?  It seems to make sense
(rather intuitively) to me.

If you could talk about that, perhaps?  I really am quite ignorant of
several of the choices that are out there.

Thanks,
--Scott

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html






---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: