
11 Nov
2004
11 Nov
'04
12:15 p.m.
David Abrahams wrote:
"Peter Dimov" <pdimov@mmltd.net> writes:
template<class T> void write( std::ostream & os, boost::shared_ptr<T> const & pt ) { if( pt ) { int pid = wpmap[ pt ];
if( pid != 0 ) { write( os, pid ); } else { pid = wpmap.size();
I could be wrong, but don't you need to add 1 here? wpmap starts out empty, after all.
It's a complete and working program, just run it. ;-) wpmap[pt] has already added the element. map::find-based code needs +1.