Boost logo

Boost Users :

From: Richard (richard_at_[hidden])
Date: 2007-10-13 05:56:25


I can't be certain this is your problem but here is an idea.

Some of the MS classes do extra checks in DEBUG mode. Check that your
operator < implementation does not return true for objects that are actually
equal.

HTH,

- Richard

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Surya Kiran
Gullapalli
Sent: 13 October 2007 10:50
To: boost-users_at_[hidden]
Subject: [Boost-users] ptr_set problems

Hello,
I'm using ptr_set for one of my classes whose structure is like this.
===============================
using namespace boost;

class A: less_than_comparable<A>, equality_comparable<B>, noncopyable
{
   friend operator< (const A&, const A&) ;
   public:
      A()
      virtual ~A ()
      virtual void fun1() = 0 ;

}

class B: public A
{
   public:
      B () ;
      ~B () ;
      virtual void fun1()
      {
         cout << "Func1 in B" << endl ;
      }
}

class C : public A
{
   public:
      C () ;
      ~C () ;
      virtual void fun1()
      {
         cout << "Func1 in C" << endl ;
      }
}
==============================================
and I'm inserting into ptr_set like this.

A *varb = new B () ;
A *varc = new C() ;

ptr_set <A> Aset ;
Aset.insert (varb) ;
Aset.insert (varc) ;

****************

Compilation is fine on windows (VS2005) and linux (gcc-4.1.2)
On linux, the code executes fine.
But on windows, I'm getting a DEBUG ASSERTION failure during
insertion. The failure says, Expression: invalid operator<. This
happens in debug version only. In release version, the code executes
fine on windows also.

Any help on how to attack this problem is greatly appreciated.

Thanks in advance,
Surya
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net