Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2000-03-15 23:52:35


The compiler is looking for an operator<, which shared_ptr
doesn't have. It does have a less functor, which you should
be able to supply as a further template argument.

----- Original Message -----
From: Paul Jensen <pdjensen_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, March 15, 2000 1:30 PM
Subject: [boost] Problem with shared_ptr

> I've been trying to understand why I cannot use shared_ptr in a set. The
> environment is VC++5.0 with <memory> modified for the current version of
> auto_ptr. Here's the code which draws 6 errors like:
>
> C:\Program Files\DevStudio\VC\INCLUDE\functional(81) : error C2784: 'bool
> __cdecl std::operator <(const class
> std::multiset<`template-parameter-1',`template-parameter-2',`template-parameter-3'>
> &,const class
> std::multiset<`template-parameter-1',`template-parameter-2',`template-parameter-3'>
> &)' : could not deduce template argument for 'const class
> std::multiset<`template-parameter-1',`template-parameter-2',`template-parameter-3'>
> &' from 'const class boost::shared_ptr<int>'
>
>
> #pragma warning (disable:4786)
>
> #include <memory>
> #include <boost/smart_ptr.hpp>
> #include <set>
>
> using boost::shared_ptr;
> using namespace std;
>
> int main(int argc, char *argv[]) {
> set< shared_ptr<int> > msgSet;
> msgSet.insert( shared_ptr<int>( new int(8) ) );
> }
>
> Thanks,
> Paul
> --
> Paul Jensen Agile Image Movers http://agileimage.com
>
> ------------------------------------------------------------------------
> Enjoy 200 FREE Photos including FREE shipping to you, your
> friends & family. Shutterfly delivers beautiful 35mm quality
> prints from your digital camera - ready for frames or photo albums.
> http://click.egroups.com/1/2144/1/_/9351/_/953181396/
>
> eGroups.com Home: http://www.egroups.com/group/boost/
> http://www.egroups.com - Simplifying group communications
>
>
>


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