I have a piece of STL code which compiled perfectly with VC++ 6.0 and
VS .NET 2003 but I get loads of errors for it in VS 2005.
The code is as follows:
class CTimeKey: public pair<wstring, wstring{};
class CTimeFactors
{
public:
double calendar_factor ;
double calendar_days;
bool pattern_check;
double pattern_factor;
};
class CTimeLine: public map<CTimeKey, CTimeFactors{};
CTimeLine::iter ator l_time_iterator ;
....
if (l_time_iterato r == NULL) {
....
}
The error is for the NULL comparison operation and is as follows:
error C2678: binary '==' : no operator found which takes a left-hand
operand of type 'std::_Tree<_Tr aits>::iterator ' (or there is no
acceptable conversion)
with
[
_Traits=std::_T map_traits<CTim eKey,CTimeFacto rs,std::less<CT imeKey>,std::al locator<std::pa ir<const
CTimeKey,CTimeF actors>>,false>
]
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSD K
\include\guidde f.h(192): could be 'int operator ==(const GUID &,const
GUID &)'
C:\Program Files\Microsoft Visual Studio 8\VC\include
\xtree(287): or 'bool std::_Tree<_Tra its>::const_ite rator::operator
==(const std::_Tree<_Tra its>::const_ite rator &) const'
with
[
_Traits=std::_T map_traits<CTim eKey,CTimeFacto rs,std::less<CT imeKey>,std::al locator<std::pa ir<const
CTimeKey,CTimeF actors>>,false>
]
while trying to match the argument list
'(std::_Tree<_T raits>::iterato r, int)'
with
[
_Traits=std::_T map_traits<CTim eKey,CTimeFacto rs,std::less<CT imeKey>,std::al locator<std::pa ir<const
CTimeKey,CTimeF actors>>,false>
]
Any ideas how to resolve this?
Thanks and regards,
Ankan 1 2563 an************@ gmail.com wrote:
I have a piece of STL code which compiled perfectly with VC++ 6.0 and
VS .NET 2003 but I get loads of errors for it in VS 2005.
Well, first you should probably post in a C++ newsgroup instead of a C#
newsgroup.
>
The code is as follows:
class CTimeKey: public pair<wstring, wstring{};
class CTimeFactors
{
public:
double calendar_factor ;
double calendar_days;
bool pattern_check;
double pattern_factor;
};
class CTimeLine: public map<CTimeKey, CTimeFactors{};
CTimeLine::iter ator l_time_iterator ;
...
if (l_time_iterato r == NULL) {
[snipped more code]
Any ideas how to resolve this?
Iterators are not required to be comparable to null. It might work on some
implementations , but there's no guarantee. Instead, you need to compare the
iterator to another iterator, such as the one returned by end():
if (l_time_iterato r == end())
It's also not a good idea to derive from std::pair or std::map since those
classes weren't designed to work as a base class. As long as you don't ever
call delete through a pointer to the base class, you won't have any
problems, but it's usually recommended to avoid the construct in the first
place.
-cd This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rob Ratcliff |
last post by:
I'm compiling the latest version of a CORBA ORB called MICO on a Cray
X1. It makes heavy use of templates and namespaces.
Up until the link step, the C++ source code compiled flawlessly. But,
when it tried to link, I got the attached warnings and then an error.
Any ideas why the linker wouldn't see the objects in the library? They
look like pretty long names,
so maybe there is some type of symbol length or mangling issue going
on? The...
|
by: Paul Cochrane |
last post by:
Hi all,
I've got an application that I'm writing that autogenerates python code
which I then execute with exec(). I know that this is not the best way to
run things, and I'm not 100% sure as to what I really should do. I've had a
look through Programming Python and the Python Cookbook, which have given me
ideas, but nothing has gelled yet, so I thought I'd put the question to the
community. But first, let me be a little more detailed...
|
by: Erik |
last post by:
Hi Everyone,
I'm having real problems compiling some source for eVC4++. The errors
I am getting are below:
It all seems to be centred around winsock. If I move the afsock.h
reference to before my other includes then I get lots of errors like
C2011: 'fd_set' : 'struct' type redefinition
warning C4005: 'FD_CLR' : macro redefinition
which I understand are due to the fact that windows.h is being
included in another header file as well as...
|
by: tshad |
last post by:
I am just trying to decide whether to split my code and uses code behind. I
did it with one of my pages and found it was quite a bit of trouble.
I know that most people (and books and articles) like it because you can
split the code from the design. That is logical. But if you are the only
one working on the code, it seem a little overkill.
I use Dreamweaver to do my design and find it a bit of a hassle to have
multiple files open...
|
by: jtertin |
last post by:
Can you force VS 2005 to compile a program to be compatible with
version 1.x of the .NET Framework? HOW!?
| |
by: Daniel Knöpfel |
last post by:
Hi all
I need to adapt an Msbuild script to compile a visual studio 2005 solution
(including several projects and a website). The application is written in C#
and using .NET 2.0. Due to late changes the application uses unsafe code in
one project. Compiling in VS 2005 is no problem, however the build script
that we used no longer works. Unfortunately i dont not have any experience
in making build scripts using Msbuild. How does one add a...
|
by: Andreas Schmitt |
last post by:
I am workin on a 2 part project right now. The first part is a DLL, the
second part a normal exe using that DLL.
When I use the VS2005 standard setting for compiling with the
Multithreaded-DLL runtime library (compiler option /MD )everything works
fine on my PC. But when I try to run the thing on a friends PC or my
laptop I get:
"This application has failed to start because the application
configuration is incorrect.
|
by: lewisms |
last post by:
Hello all,
I am quite new to c++/. Net so please don't shoot me down for being a newbie. Any way I am trying to make a simple multithreading program that is just to learn the ideas behind it (before I incorporate them in another program). I just can’t seem to get a non-static call to work in my thread that has access to the Form1 variables and controls I need. I can call a non-static function using another class but then I can seem to get in...
|
by: drajesh |
last post by:
hi all,
I had a code which is compiling fine on VC++ 6.0 ..but on compiling same code in VS 2005 i m facing following error.
error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'CtiCallHandle' (or there is no acceptable conversion)
c:\documents and settings\administrator\desktop\rajesh\osi_view\projects\ciscotsp\projects\ciscotsp\SelsiusTSPCall.h 134
static bool IsCtiCallHandleValid(CtiCallHandle...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |