473,385 Members | 1,838 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,385 software developers and data experts.

need for typedef for instances of template classes

In Sutter's book - More Exceptional C++, on page 27 - there is

typedef IsDerivedFrom1<t, Cloanable > Y;

where he specifies that "typedef is needed it otherwise the , will be
interpeted as delimiting macro parameters to assert.

assert(Y:Is);

etc...

why would it be interpetted this way? if that the case, typename is
need. someone please explain

Sep 16 '05 #1
1 1048
puzzlecracker wrote:
In Sutter's book - More Exceptional C++, on page 27 - there is

typedef IsDerivedFrom1<t, Cloanable > Y;

where he specifies that "typedef is needed it otherwise the , will be
interpeted as delimiting macro parameters to assert.

assert(Y:Is);

etc...

why would it be interpetted this way? if that the case, typename is
need. someone please explain


In

assert(IsDerivedFrom1<t, Cloanable >::Is);

The comma is indeed interpreted as seperating two macro parameters. This
is because macro substitution is done before anything else (more or less).

Not sure why you think typename is also needed, that would depend on the
context.

john
Sep 16 '05 #2

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

Similar topics

3
by: Andrew | last post by:
Hi, I am thinking about ways for efficient techniques for isolation testing. Here is the problem as I see it: Complex OO systems are designed with massive number of dependencies between modules...
7
by: Lasse Skyum | last post by:
I'm wondering if there is any way to do run-time checking for the size of class-instances? The only idea I've come up with is overloading operator new and saving the size passes to it on the...
3
by: david.corby | last post by:
Hi again everyone! I was wondering if there is any way to specify a return type for a template class member function that is typedef'd in the class. I.E... template <class T> class A { ...
11
by: Micha | last post by:
Hello there, I think I've run into some classic c++ pitfall and maybe some of you guys can help me out. For my project I will need to use matrices and vectors and so I decided to implement them...
5
by: aaragon | last post by:
Hello everybody, I appreciate your taking the time to take a look at this example. I need some help to start the design of an application. To that purpose I'm using policy-based design. The...
12
by: aaragon | last post by:
Hello all. I have a simple question that seems trivial but I can't make it to work. I have a class that takes as a template argument, another class. The idea is as follows: #include...
5
by: Grizlyk | last post by:
I found, that I must write explicit cast from non-const reference to const reference. I have a class with member returning non-const reference to itself template<class A,class B,class C>...
10
by: jlongstreet | last post by:
Please correct any misconceptions, or voice concerns about this being a stupid idea in general. I was wondering today: why doesn't C++ have explicit typedefs? explicit typedef unsigned int...
15
by: Jess | last post by:
Hello, Sometimes declarations are all what we need when we define/declare classes (or functions?), but sometimes we need definitions. I learned that if we define a class (B) that has an object...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.