Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Templated typedefs

Reply
Thread Tools

Templated typedefs

 
 
Juha Nieminen
Guest
Posts: n/a
 
      02-26-2008
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?
 
Reply With Quote
 
 
 
 
Michael DOUBEZ
Guest
Posts: n/a
 
      02-26-2008
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<int>::type);

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


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

>
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
templated function as parameter of another templated function Amadeus W. M. C++ 2 07-04-2006 09:59 PM
ASP.NET Templated User Controls - Limit child controls allowable within a templated control JohnyStyles@gmail.com ASP .Net 0 05-29-2006 06:00 PM
When can I have my templated typedefs? DeMarcus C++ 7 08-07-2004 02:43 PM
Subtypes of templated types (in templated functions) Marijn C++ 5 02-13-2004 09:50 AM
implementing a templated struct within a templated struct RA Scheltema C++ 3 01-06-2004 11:25 AM



Advertisments