Boost logo

Boost :

From: Paul Jensen (pdjensen_at_[hidden])
Date: 2000-03-15 15:30:14


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

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