Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > using + template - how has this been resolved?

Reply
Thread Tools

using + template - how has this been resolved?

 
 
Helmut Jarausch
Guest
Posts: n/a
 
      02-01-2011
Hi,

there is the following example in Vandevoorde/Josuttis
C++ Templates (7th printing) ch 9.3.4 p 134

template <typename T>
class BXT {
public:
typedef T Mystery;
template<typename U>
struct Magic;
};

template <typename T>
class DXTM : private BXT<T> {
public:
// using BXT<T>::template Magic; // fails
// Most likely this is an oversight in the standard specifications
// and future revisions will probably make the previous construct valid

// using BXT<T>::Magic; // fails
Magic<T>* plink;
};

How has this been resolved?

Many thanks for some info.

Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany





 
Reply With Quote
 
 
 
 
Johannes Schaub (litb)
Guest
Posts: n/a
 
      02-01-2011
Helmut Jarausch wrote:

> Hi,
>
> there is the following example in Vandevoorde/Josuttis
> C++ Templates (7th printing) ch 9.3.4 p 134
>
> template <typename T>
> class BXT {
> public:
> typedef T Mystery;
> template<typename U>
> struct Magic;
> };
>
> template <typename T>
> class DXTM : private BXT<T> {
> public:
> // using BXT<T>::template Magic; // fails
> // Most likely this is an oversight in the standard specifications
> // and future revisions will probably make the previous construct valid
>
> // using BXT<T>::Magic; // fails
> Magic<T>* plink;
> };
>
> How has this been resolved?
>


It has not been resolved, and probably won't be resolved. See
http://www.open-std.org/jtc1/sc22/wg...losed.html#109
 
Reply With Quote
 
 
 
 
Johannes Schaub (litb)
Guest
Posts: n/a
 
      02-01-2011
Helmut Jarausch wrote:

> Hi,
>
> there is the following example in Vandevoorde/Josuttis
> C++ Templates (7th printing) ch 9.3.4 p 134
>
> template <typename T>
> class BXT {
> public:
> typedef T Mystery;
> template<typename U>
> struct Magic;
> };
>
> template <typename T>
> class DXTM : private BXT<T> {
> public:
> // using BXT<T>::template Magic; // fails
> // Most likely this is an oversight in the standard specifications
> // and future revisions will probably make the previous construct valid
>
> // using BXT<T>::Magic; // fails
> Magic<T>* plink;
> };
>
> How has this been resolved?
>


What I've previously overlooked: I think you *can* say the following,
though. It is the name of a member template. Not the name of a member
template specialization.

using BXT<T>::Magic;

The error is at the point of use, because it does not know whether Magic
refers to a class template or not.

typename DXTM<T>::template Magic<T> *plink;
 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
the tutor list has been strangely silent for a few days. Anyone knowwhat has happened? bill.wu Python 0 01-17-2008 03:38 PM
The printing has been stopped and this job has been add to the queu? dejola Computer Support 6 12-30-2005 03:26 AM
I need help I has been over 6 months since I've been able to do the system check for updates Marc Computer Support 8 07-25-2005 07:04 PM
Using object after it has been put in Session Aleksey Dmitriyev ASP .Net 0 10-17-2003 12:34 AM



Advertisments