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

Template disambiguation

I just tried to build under GNU C++ 3.4.1 and then 3.4.3 a program which was
working fine under G++ 3.3.*

It uses template members "shm_cast" to obtain a pointer "foo *" to a
structure in shared memory from an offset "off" thus

template<typename T> T *shm_cast(const shmoff_t off) const
{
return static_cast<T*>(shmp(off));
}

used thus:

foo *item = seg.template shm_cast<foo>(off);

This is according to Stroustrup Appendix C13.6

If "template" is left out there it doesn't parse it right as was the case in
G++ 3.3.*.

It works fine with 3.3.* but with G++ 3.4.* it reports

error: `template' (as a disambiguator) is only allowed within templates

Please can anyone advise if G++ 3.4.* is broken or has some different syntax
been coined for this I haven't heard about.

Thanks if anyone can help.

--
John Collins Xi Software Ltd www.xisl.com
Jul 22 '05 #1
1 2207
"John Collins" <jm*@nospam.xisl.com> wrote...
I just tried to build under GNU C++ 3.4.1 and then 3.4.3 a program which
was
working fine under G++ 3.3.*

It uses template members "shm_cast" to obtain a pointer "foo *" to a
structure in shared memory from an offset "off" thus

template<typename T> T *shm_cast(const shmoff_t off) const
{
return static_cast<T*>(shmp(off));
}

used thus:

foo *item = seg.template shm_cast<foo>(off);

This is according to Stroustrup Appendix C13.6

If "template" is left out there it doesn't parse it right as was the case
in
G++ 3.3.*.

It works fine with 3.3.* but with G++ 3.4.* it reports

error: `template' (as a disambiguator) is only allowed within templates

Please can anyone advise if G++ 3.4.* is broken or has some different
syntax
been coined for this I haven't heard about.

Please post _complete_ code that can be run through a compiler.

V
Jul 22 '05 #2

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

Similar topics

2
by: Xenos | last post by:
The new version of GCC is out and in its list of changes, it talks about the C++ Standard's requirements for using the typename and template keywords to disambiguate dependent names. I'm use to...
31
by: nikola | last post by:
Hi all, I was working with a simple function template to find the min of two values. But since I would like the two values to be different (type) I dont know what kind of value (type) it will...
3
by: Rüdiger Knörig | last post by:
I've a nasty problem here (g++ 3.4/4.0): I've a template datatype mltreenode<T> from which I instanced a STL vector vector< mltreenode<T> * > without any problems. Calling methods on this object...
2
by: Rudy Ray Moore | last post by:
Whenever I get any error with Vc++7.1/.net/2003, it is followed by huge ammounts of "template assistance" error messaging referencing template code (MTL) that has nothing to do with the error. ...
10
by: Petr Jakeš | last post by:
I have a standard 12-key mobile phone keypad connected to my Linux machine as a I2C peripheral. I would like to write a code which allows the text entry to the computer using this keypad (something...
2
by: Imre | last post by:
Hi Please consider the following code: template <class T> struct Base; template <template <typenameclass T, typename P> struct Base<T<P {
8
by: IR | last post by:
Hello, Does anyone know why this declaration compiles: template< template<typenameclass T> class X { /*...*/ }; while this one doesn't: template< template<typenametypename T>
19
by: aaragon | last post by:
Hi everyone. A very simple question. I would like to know what is better in terms of performance. I want to use a simple function to obtain the minimum of two values. One way could be using a...
3
by: Hamilton Woods | last post by:
Diehards, I developed a template matrix class back around 1992 using Borland C++ 4.5 (ancestor of C++ Builder) and haven't touched it until a few days ago. I pulled it from the freezer and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.