Boost logo

Boost :

From: Neal D. Becker (nbecker_at_[hidden])
Date: 2002-09-18 08:59:36

I notice an unexpected difference between ptr, auto_ptr, and

#include <memory>
#include <boost/shared_ptr.hpp>
#include <iostream>

typedef std::iostream X;

struct Options {
  X* x;
  std::auto_ptr<X> y;
  boost::shared_ptr<X> z;
  Options() :

g++3 -c -I /usr/local/src/boost In constructor `Options::Options()': no matching function for call to `boost::shared_ptr<X>::shared_ptr(
/usr/local/src/boost/boost/shared_ptr.hpp:74: candidates are:
   boost::shared_ptr<X>::shared_ptr(const boost::shared_ptr<X>&)
   boost::shared_ptr<T>::shared_ptr() [with T = X]

The initialization of plain ptr with "0" is OK, and so is auto_ptr,
but not shared_ptr. Why? Is this a defect?

Boost list run by bdawes at, gregod at, cpdaniel at, john at