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

Parameterized Template Parameters

Consider the following:

#include <map>

template <class T>
void f()
{
typedef std::map<T, int> Mymap;
Mymap::iterator iter;
}

Compiling with both GCC and Comeau gives an error along the lines of
`expected a ";" before "iter".' The same code with the map parameter
T replaced with a concrete type compiles just fine. Instantiating a
"Mymap" seems to work.

Why can I create a "Mymap" object, but not a "Mymap::iterator" object?

Cheers,
-- Aaron
Dec 9 '05 #1
2 1295

Aaron Carroll wrote:
Consider the following:

#include <map>

template <class T>
void f()
{
typedef std::map<T, int> Mymap;
Mymap::iterator iter;


typename Mymap::iterator iter;

Dec 9 '05 #2

Neelesh Bodas wrote:
Aaron Carroll wrote:
Consider the following:

#include <map>

template <class T>
void f()
{
typedef std::map<T, int> Mymap;
Mymap::iterator iter;


typename Mymap::iterator iter;


The compilers are correct to reject the code but it would be nice if
they could identify the error and give an appropriate message.
(Something compiler vendors could work on perhaps?)

Dec 9 '05 #3

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

Similar topics

0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
1
by: gary b | last post by:
Hello When I use a PreparedStatement (in jdbc) with the following query: SELECT store_groups_id FROM store_groups WHERE store_groups_id IS NOT NULL AND type = ? ORDER BY group_name
7
by: Wayne Wood | last post by:
i posted this problem on microsoft.public.excel.programming, but there's no one replied till now. because this issue is time critical, i put it here to try my fortune :) ...
16
by: christopher diggins | last post by:
It appears that the following is not considered a class: template<typename T> class C { }; ? So officially is this considered: a class, a template, a class template, or a template class? I...
8
by: deko | last post by:
I'm trying to open a Recordset based on a parameterized query. I'm kind of new to parameterized queries, so I'm sure I'm missing something simple. Set qdfs = db.QueryDefs Set qdf =...
2
by: deko | last post by:
Is it possible to build a parameterized query from another parameterized query? I've tried two variations of this and can't seem to get it to work (using DAO). Any suggestions welcome! I...
11
by: anony | last post by:
Hello, I can't figure out why my parameterized query from an ASP.NET page is dropping "special" characters such as accented quotes & apostrophes, the registered trademark symbol, etc. These...
10
by: ryan.mclean | last post by:
Hi all, I am new to using sql server and parameterized sql. I am hoping to be returned the value of a column that has been inserted. Here is my statement strSqlInsetrtTrack = _ "INSERT INTO...
3
by: =?iso-8859-1?q?Erik_Wikstr=F6m?= | last post by:
I'd like to create a partial specialization of a member-method of a parameterized class which takes a parameterized argument, but I'm not sure if it's possible or, if possible, how. The following...
0
by: BenCoo | last post by:
Hello colleagues, I have a ObjectDataSource wich is linked to a SQL Server 2005 database I a gridview I have data and on each row a "Edit button" wich wil show the selected record in editmode....
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...
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?
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
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...

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.