Templated typedefs

J

Juha Nieminen

Apparently something like this is not currently possible:

template<typename T>
typedef bool(*VectComp)(const std::vector<T>&, const std::vector<T>&);

void foo(VectComp<int>);

template<typename T>
void bar(VectComp<T>);

Will this be possible in the next C++ standard?
 
M

Michael DOUBEZ

Juha Nieminen a écrit :
Apparently something like this is not currently possible:

template<typename T>
typedef bool(*VectComp)(const std::vector<T>&, const std::vector<T>&);

No. template oftypedef are not allowed.
Current usage is:

template<typename T>
struct VectComp
{
typedef bool(*type)(const std::vector<T>&, const std::vector<T>&);
};

void foo(VectComp<int>);

void foo(VectComp said:
template<typename T>
void bar(VectComp<T>);

template<typename T>
void bar(typename VectComp said:
Will this be possible in the next C++ standard?

AFAIK not under this form, it will use aliasing.
See: http://www.artima.com/cppsource/cpp0x.html

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top