template<class K, class T, class W>
class AMI_cache_manager_static: public AMI_cache_manager_base {
private:
map<K,Tdata_;
size_t current_size;
W writeout_;
public:
AMI_cache_manager_static(size_t capacity) :
AMI_cache_manager_base(capacity, 0), writeout_() {
current_size = 0;
}
~AMI_cache_manager_static(){
map<K,T>::iterator it;
it = data_.begin();
while (it != data_.end()) {
writeout_(it->second);
it++;
}
}
I have the above code, but where there is the map<K,T>::iterator it;
it gives me an error message that a ; must be placed before it.
If I change map<K,T>::iterator it; to map<string,string>::iterator it;
it works, but I need them as a template since they are not string.
Thanks for any help. 2 1237
algatt wrote:
template<class K, class T, class W>
class AMI_cache_manager_static: public AMI_cache_manager_base {
private:
map<K,Tdata_;
size_t current_size;
W writeout_;
public:
AMI_cache_manager_static(size_t capacity) :
AMI_cache_manager_base(capacity, 0), writeout_() {
current_size = 0;
}
~AMI_cache_manager_static(){
map<K,T>::iterator it;
typename map<K,T>::iterator it;
it = data_.begin();
while (it != data_.end()) {
writeout_(it->second);
it++;
}
}
I have the above code, but where there is the map<K,T>::iterator it;
it gives me an error message that a ; must be placed before it.
If I change map<K,T>::iterator it; to map<string,string>::iterator it;
it works, but I need them as a template since they are not string.
Read the FAQ, will you?
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
map<K,T>::iterator it;
*snip*
I have the above code, but where there is the map<K,T>::iterator it;
it gives me an error message that a ; must be placed before it.
If I change map<K,T>::iterator it; to map<string,string>::iterator it;
it works, but I need them as a template since they are not string.
You have to tell the Compiler that map<K,T>::iterator is indeed a type:
typename map<K,T>::iterator it;
From a purely syntactical viewpoint it might as well be a static
variable. And since the Compiler does not know what K and T are, it
cannot check what map<K,T>::iterator is. If you use map<string,
string>::iterator, the compiler can easily check that iterator is a type
and not a static variable (or function). That's why it works without
typename in that case.
Regards,
Ignaz This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: AIM |
last post by:
Error in msvc in building inheritance.obj to build hello.pyd
Hello,
I am trying to build the boost 1.31.0 sample extension hello.cpp.
I can not compile the file inheritance.cpp because the two...
|
by: Gregory |
last post by:
Hi,
One of the disadvantages of using error handling with error codes
instead of exception handling is that error codes retuned from a
function can be forgotten to check thus leading to...
|
by: deko |
last post by:
I use this convention frequently:
Exit_Here:
Exit Sub
HandleErr:
Select Case Err.Number
Case 3163
Resume Next
Case 3376
Resume Next
|
by: p |
last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also
have Crystal 9 pro on my development machine. The web app runs fine on my
dev machine but am having problems deploying....
|
by: Manuel |
last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using
devc++.
So I've imported the glut32.dsp into devc++, included manually some
headers, and start to compile.
It return a very...
|
by: bazzer |
last post by:
hey,
im trying to access a microsoft access database from an ASP.NET web
application in visual basic 2003.NET. i get the following error when i
try running it:
Server Error in...
|
by: developer |
last post by:
Hi All
I have made a .NET project.
the files included are borland c++ files that i am migrate to VC++ .NET
I am using Microsoft Visual C++ .NET 2003.
the compilation goes through properly,...
|
by: mchuc7719 |
last post by:
Hello,
I have a Vb.Net 2005 ClassLibrary, when I try to compile using MSBee, only
get errors.
Before I to run the command line, I open in notepad the .vbproj and I was
add the next line:
...
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I...
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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: 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...
|
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,...
| |