P
pastbin
Dear members,
I would like to know if it exists a technique that would make the
following code possible:
//----
template<int ID>
struct ident
{
//...
};
void create_ident()
{
// the function body would contain that kind of expression:
/*...*/new ident<AUTO_INCREMENT_COUNTER>();
// where AUTO_INCREMENT_COUNTER is controlled/generated
// by the compiler
}
int main()
{
create_ident(); // would create ident<0>()
create_ident(); // ident<1>()
//..
}
//----
I can't think of a solution for this problem. Of course I could make
function create_ident() templated and simply call create_ident<N>()
but this is not what i want.
What do you think of such a behavior ?
Thank you,
mark
I would like to know if it exists a technique that would make the
following code possible:
//----
template<int ID>
struct ident
{
//...
};
void create_ident()
{
// the function body would contain that kind of expression:
/*...*/new ident<AUTO_INCREMENT_COUNTER>();
// where AUTO_INCREMENT_COUNTER is controlled/generated
// by the compiler
}
int main()
{
create_ident(); // would create ident<0>()
create_ident(); // ident<1>()
//..
}
//----
I can't think of a solution for this problem. Of course I could make
function create_ident() templated and simply call create_ident<N>()
but this is not what i want.
What do you think of such a behavior ?
Thank you,
mark