Boost logo

Boost Users :

From: Stephen torri (storri_at_[hidden])
Date: 2004-11-08 12:10:38


On Mon, 2004-11-08 at 11:32, Doug Gregor wrote:

> A property writer is passed the output stream and the descriptor, so
> you want to write Component_Writer like so:
>
> class Component_Writer {
> public:
> typedef boost::graph_traits<Graph_Type>::vertex_descriptor
> Vertex_Type;
>
> Component_Writer(const Graph_Type& g) : g(g) {}
>
> void operator()(std::ostream& out, Vertex_Type v)
> {
> boost::shared_ptr<Component> obj_ptr = get(vertex_name, g, v);
> // code from before...
> }
> };
>
> Doug
>

So if I store the Component in the Vertex by value instead of within a
boost::shared_ptr then I would write the Component_Writer as:

class Component_Writer {
public:

        typedef boost::graph_traits<Graph_Type>::vertex_descriptor Vertex_Type;

        Component_Writer (const Graph_Type& g) : g(g) {}

        void operator() (std::ostream& out, Vertex_Type v)
        {
           Component obj = get (vertex_name, g, v);
           // code from before.
        }

I appreciate the information. I will try these changes.

Stephen

-- 
Email: storri_at_[hidden]

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net