473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Templated typedefs

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?
Feb 26 '08 #1
1 1277
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
Feb 26 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: emerth | last post by:
Suppose I have these 4 typedefs, where each of the 2nd parameter in each is a simple class that just contains a different number of strings: typedef map < char*, cctrlrec_data, ltstr >...
3
by: tirath | last post by:
Hi all, I have a templated class that derives from a non-templated abstract class. How do I then cast a base class pointer to a <templated> derived class pointer in a generalised fashion? ...
1
by: Rich | last post by:
Hi, I have a query regarding VC6 and its handling of templated copy constructors. Here goes: Take a look at the following code sample... template<class _Ty, size_t t_uiSize = 10 > class...
2
by: Jorge Yáñez | last post by:
Hello, It's possible to do a forward declaration of a typedef? Something similar to typedef TMyType; // typedef forward declaration void f ( TMyType& t )
1
by: Michal Wróbel | last post by:
Hello, I've got few questions concerning typedefs inside class definition. Firstly, I'll give an example code: template< class T > class Function { public: typedef boost::shared_ptr<...
13
by: algorimancer | last post by:
I use the STL collection classes a lot, and frequently find myself writing something like: vector<CDataClass>::iterator iter=DataClassCollection.begin(); vector<CDataClass>::iterator...
15
by: kwikius | last post by:
Hi all, I have been searching through the list of papers at: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/ I seem to remember a proposal regarding templated namespaces e.g: template...
2
by: Olaf | last post by:
Hi, I'm working on a thin libcurl layer. Therefore I have the following classes: template<typename T, long CURLOPT_ID> class CurlOption: boost::noncopyable { public: typedef typename...
2
by: domehead100 | last post by:
I have a templated class, CDerived: template <typename TValue, typename TDraw, typename TEdit ...> class CDerived : public CBase { TValue m_Value public: TValue& GetValue() const {
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.