Compiling...
mScanList.cpp
D:\C++\mScanList.cpp(81) : warning C4786: 'std::reverse_iterator,std::allocator >,std::allocator,std::allocator > > >::const_iterator,
std::basic_string,std::allocator >,std::basic_string,std::allocator > const &,std::basic_string,std::allocator > const *,int>' : identifier was tru
ncated to '255' characters in the debug information
D:\C++\mScanList.cpp(81) : warning C4786: 'std::reverse_iterator,std::allocator >,std::allocator,std::allocator > > >::iterator,std::b
asic_string,std::allocator >,std::basic_string,std::allocator > &,std::basic_string,std::allocator > *,int>' : identifier was truncated to '255' ch
aracters in the debug information
c:\program files\microsoft visual studio\vc98\include\deque(191) : warning C4786: 'std::deque,std::allocator >,std::allocator,std::allocator > >
>::deque,std::allocator >,std::allocator,std::allocator > > >' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\deque(208) : warning C4786: 'std::deque,std::allocator >,std::allocator,std::allocator > >
>::~deque,std::allocator >,std::allocator,std::allocator > > >' : identifier was truncated to '255' characters in the debug information
mScanList.obj - 0 error(s), 4 warning(s)
VC++ outputs those warnings no even when I used the second technique which the compile ignored because of /* and */.
Does anyone know what it is talking about and how to elimate the warnings?
Thanks,
Kuphryn
Edited by - kuphryn on December 1, 2001 12:37:20 AM
Compile Error Due to STL & Iterator
Hi.
I posted two threads earlier about STL and cin, cout, ifstream and ofstream. I implemented code based on inputs from other members.
Here is the code:
void ScanList::scanData(ifstream &source, ofstream &output)
{
string oneLine;
std::deque dataList;
while(veri)
{
std::getline(source, oneLine);
if (oneLine[0] == NULL || !isdigit(oneLine[0]))
{
if (source.eof())
{
veri = false;
continue;
}
else
continue;
}
else
dataList.push_back(oneLine);
if (source.eof())
veri = false;
}
std::unique(dataList.begin(), dataList.end());
/*
std::deque::iterator beginITER = dataList.begin();
while (beginITER != dataList.end())
{
output << *beginITER;
beginITER++;
}
*/
std::ostream_iterator outFile(output, "\n");
std::copy(dataList.begin(), dataList.end(), outFile);
dataList.clear();
}
VC++ gave these four warnings:
Those warnings have nothing to do with your code. If you look up "C4786" in MSDN, you''ll find that it simply occurs when an identifier exceeds 255 characters in length, and can not be displayed in the debugger. Since every class in the STL is template-based, the final identifier names (including type) is usually in excess of 255 chars. C4786 is an informational warning.
To turn it off, before including the STl headers use the #pragma preprocessor directive.
To turn it off, before including the STl headers use the #pragma preprocessor directive.
#pragma warning( disable : 4786 )#include <deque>// other STL headers, etc
The warning is: "identifier was truncated to ''255'' characters in the debug information"
Takes care of the problem
Magmai Kai Holmlor
- Not For Rent
#pragma warning (disable: 4786)
Takes care of the problem
Magmai Kai Holmlor
- Not For Rent
I got the code working perfect. I use the vector contain, but the find() function first check to see if the data is already in the contain. If find() does not return end(), then the program inserts the data into the contain. It works great.
I have a question. I tried using the unique function with several containers including vector, deque and list. it does not seem to work unless the data inside the container is sorted.
I tried using the set container. Set automatically ignore clones, but it sorts the data inside the container by default. Is there a way to keep the data in its original order?
Kuphryn
I have a question. I tried using the unique function with several containers including vector, deque and list. it does not seem to work unless the data inside the container is sorted.
I tried using the set container. Set automatically ignore clones, but it sorts the data inside the container by default. Is there a way to keep the data in its original order?
Kuphryn
Unique only removes adjacent elements, just like it says in the docs. If you want to remove all copies, it must be sorted.
You can either keep your insertion order, or you can sort. You can''t do both without some trickery. One way to do it would be to store in your container both the insertion index (e.g. first element gets 0, second gets 1, etc.) and your actual value. Use the predicate version of sort to sort by your actual value, remove copies with unique, and then re-sort by the insertion index to put things back in the original order.
Another idea: keep both a set and a vector in parallel. Before inserting, check the set to see if it exists; if it''s there, don''t put it in the vector. You just have to be sure you always add or remove from both. I prefer this method. You could even make a class (probably _should_) to wrap this behavior.
You can either keep your insertion order, or you can sort. You can''t do both without some trickery. One way to do it would be to store in your container both the insertion index (e.g. first element gets 0, second gets 1, etc.) and your actual value. Use the predicate version of sort to sort by your actual value, remove copies with unique, and then re-sort by the insertion index to put things back in the original order.
Another idea: keep both a set and a vector in parallel. Before inserting, check the set to see if it exists; if it''s there, don''t put it in the vector. You just have to be sure you always add or remove from both. I prefer this method. You could even make a class (probably _should_) to wrap this behavior.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement