Boost logo

Boost :

From: (nil)
Date: 2000-03-16 13:28:20


Wait, wait... I am using both template members and template functions. Two
examples:

// constructor
template<typename D> SharedPtr( const SharedPtr<D>& ptr ) {
  share( ptr );
}

// operator
template<typename T, typename D>
bool operator==( const SharedPtr<T>& ptr1, const SharedPtr<D>& ptr2 ) {
  return ptr1.ptr() == ptr2.ptr();
}

They both work fine.

I am sorry for joining the conversation late. I will look back to catch up
on the thread and make some cohesive comments. But the below statement: "Ok
MS VC++6 does not support template function" does not seem correct.

-----Original Message-----
From: Ronen Halsadi [mailto:RonenH_at_[hidden]]
Sent: Thursday, March 16, 2000 1:01 PM
To: 'boost_at_[hidden]'
Subject: [boost] Re: Questions

Ok MS VC++6 does not support template function ( =
BOOST_NO_MEMBER_TEMPLATES).
So does it mean that the smart pointer library is useless in MS VC++6 or
there's any way to make it work ??

> -----Original Message-----
> From: Valentin Bonnard [SMTP:Bonnard.V_at_[hidden]]
> Sent: ä 16 îøõ 2000 17:22
> To: boost_at_[hidden]
> Subject: [boost] Re: Questions
>
> ronenh_at_[hidden] wrote:
>
> > How can I pass APtr object to method that get ConstAPtr.
>
> Just do it.
>
> > How can I use Polymorphism with smart pointer.
>
> It should work.
>
> > class A {
> > :
> > virtual void DoIt();
> > :
> > };
> > typedef shared_ptr<A> APtr;
> > typedef shaerd_ptr<const A> ConstAPtr;
> >
> > class Drive : public A{
> > :
> > virtual void DoIt();
> > :
> > };
> > typedef shared_ptr<Drive> DrivePtr;
>
> > void main()
> ^^^^
> Hum hum
>
> > Drive d;
>
> > DrivePtr pD(&d);
> ^^
> Hum hum
>
> The following should compile:
>
> $ cat smart-ptr-const.cc
> #include "smart_ptr.h"
>
> using namespace boost;
>
> typedef shared_ptr<A> APtr;
> typedef shared_ptr<const A> ConstAPtr;
>
> void func (ConstAPtr) {}
>
> int main ()
> {
> APtr p;
> func (p);
> }
>
> (I get an ICE, but should not.)
>
> Anyway, the conversions won't work if your compiler
> doesn't support template member function.
>
> --
>
> Valentin Bonnard
>
> ------------------------------------------------------------------------
> You have a voice mail message waiting for you at iHello.com:
> http://click.egroups.com/1/2377/1/_/9351/_/953220118/
>
> -- Check out your group's private Chat room
> -- http://www.egroups.com/ChatPage?listName=boost&m=1
>

------------------------------------------------------------------------
*** Got Questions? Get Answers. Got Answers? Get Paid. ***
Sign up at Infomarco.com and you can win $30,000 cash or a trip to China.
http://click.egroups.com/1/1251/1/_/9351/_/953229845/

-- Talk to your group with your own voice!
-- http://www.egroups.com/VoiceChatPage?listName=boost&m=1


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk