If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: template for events

Originally Posted by Cambalinho

Code:

template <class T, class A>
class events : public T
{
// ...
}A;

Even if it might be possible to create a concrete instance of a template under a name that's identical to one of the template parameter names (which looks pretty weird to me by itself) using a syntax remotely similar to the one used here: How could the compiler ever be able to infer the concrete types represented by T and A here!?

I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

Re: template for events

Originally Posted by Eri523

Even if it might be possible to create a concrete instance of a template under a name that's identical to one of the template parameter names (which looks pretty weird to me by itself) using a syntax remotely similar to the one used here: How could the compiler ever be able to infer the concrete types represented by T and A here!?

thanks to both.
let ask in other(maybe i must give on that thot): how can i change the functions using objects?
someone spok(it's correct?) me about functors. can anyone please tell me more?

Re: template for events

It looks like you're just throwing syntax around, hoping something works. There seems to be very little, if any design done in what you're doing.

On a high-level, what are you trying to achieve? I have no idea what you're trying to do -- how about explaining what your goal is with this code?

My advice to you is to learn design first. For example, this last thread you were in shows the difference between throwing C++ code around with very little thought, and having a design in mind and use C++ paradigms that are commonly known. Look how I solved the problem compared to your original code:

Re: template for events

A word to the wise.

Design first, code second, test/debug last. Don't try to be too ambitious with the design. Just because the c++ language provides a 'feature' doesn't mean it has to be used unless it is appropriate for what you are trying to achieve. The further you delve into the dusty corners of c++, the more you need to understand what is going on and the less you can get away with 'winging it' with the syntax.

All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
C, C++ Compiler: Microsoft VS2015