Boost logo

Boost Users :

From: Surya Kiran Gullapalli (suryakiran.gullapalli_at_[hidden])
Date: 2007-10-13 05:50:08


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 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