Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-03-28 18:45:24


I've developed some facilities that perhaps ought to be developed into
full-fledged libraries or components of existing Boost libraries.
This work centers around my long-standing threat to build a library
that could create smart pointers safely, without ever exposing a raw
pointer to the user. For example,

  #include <memory>
  #include <boost/shared_ptr.hpp>
  #include "new.hpp"

  struct foo
  {
    foo(int&, char const*, std::auto_ptr<int> const&);
  };

  std::auto_ptr<int> x(new_<int>(3));
  std::auto_ptr<foo> y(new_<foo>(*x, "hello, world", x));
  boost::shared_ptr<foo> z(new_<foo>(*x, (char const*)"hello, world", x));

To solve this problem correctly, it was necessary to address "the
forwarding problem"
(http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm). To
that end, I developed some preprocessor macros that one can use to
generate the necessary overload sets. Is there interest in adopting
any of this code (enclosed), and if so, where should it go?



-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com



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