473,399 Members | 3,656 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,399 software developers and data experts.

Problems with "Barton Nackman Trick"

I want to use the "Barton Nackman trick" for my matrix hierarchy. But I ran
into a problem with a typedef I need in the base class:

template <typename E>
class Matrix
{
public:
typedef typename E::TT TT;

};

template <typename T>
class DenseMatrix : public Matrix<DenseMatrix<T> >
{
public:
typedef T TT;

};

this gives the error: no type named `TT' in `class DenseMatrix<double>'

Is there a chance to solve this problem, or is it even a comipler problem?

I think the approach is pretty useless if this doesn't work. Most (or even
all) methods in the base class will depend on the parameter "E::TT".

Jul 22 '05 #1
2 2384
Michael Lehn wrote:
I want to use the "Barton Nackman trick" for my matrix hierarchy. But I
ran into a problem with a typedef I need in the base class:

template <typename E>
class Matrix
{
public:
typedef typename E::TT TT;

};

template <typename T>
class DenseMatrix : public Matrix<DenseMatrix<T> >
{
public:
typedef T TT;

};

this gives the error: no type named `TT' in `class DenseMatrix<double>'

Is there a chance to solve this problem, or is it even a comipler problem?

I think the approach is pretty useless if this doesn't work. Most (or
even all) methods in the base class will depend on the parameter "E::TT".


hmmm, this seems to work:

template <typename A>
struct Traits
{
};

template <typename E>
class Matrix
{
public:
typedef typename Traits<E>::TT TT;

};

template <typename T>
class DenseMatrix : public Matrix<DenseMatrix<T> >
{
public:
typedef T TT;

};

template <typename T>
struct Traits<DenseMatrix<T> >
{
typedef T TT;
};
....is this a bug or a feature?
Jul 22 '05 #2
So is this standard conform?
Jul 22 '05 #3

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

Similar topics

7
by: Evan Simpson | last post by:
WEBoggle needs a new game board every three minutes. Boards take an unpredictable (much less than 3min, but non-trivial) amount of time to generate. The system is driven by web requests, and I...
6
by: Wonjae Lee | last post by:
I read the comment of http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/277753. (Title : Find and replace string in all files in a directory) "perl -p -i -e 's/change this/..to this/g'"...
4
by: erich93063 | last post by:
I have a stored procedure which is performing a search against a "task" table. I would like to pass in a variable called @strAssignedTo which will be a comma delimeted list of employee ID's ie:...
2
by: Marek | last post by:
Actually, the very first question I should ask is "does it make sense at all?". For 2 days I've been trying to generate C# classes using XML schema and xsd.exe tool. So far the results are not...
20
by: Tony | last post by:
I have a situation where I want to send data, but I have no need for a response. It seems to me that XMLHTTPRequest is the best way to send the data, but I don't need any response back from the...
6
by: Yehia A.Salam | last post by:
Hello, I'm trying to create my own control derived from ScrollableControl public partial class qViewer : ScrollableControl{ public qViewer() { VScroll = true; AutoScroll = true; } ... }
21
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
27
by: duli | last post by:
Hi: I would like recommendations for books (in any language, not necessarily C++, C, python) which have walkthroughs for developing a big software project ? So starting from inception, problem...
3
by: =?Utf-8?B?UGF1bCBIYWxl?= | last post by:
Moving all User Controls to a single directory has solved my problem - Thanks Eliyahu. That said, I still got one Circular ref error yesterday, rebuilt again and the build was fine? Far far...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.