Boost logo

Boost Users :

From: Ronald Garcia (garcia_at_[hidden])
Date: 2007-01-30 12:02:23


Hello Jeffrey,

It IS possible to prevent exception throws, but it will require a
little work on your part. dynamic_properties has a constructor of
the form:
dynamic_properties(
   const boost::function<
     std::auto_ptr<dynamic_property_map> (
       const std::string&, const boost::any&, const boost::any&)
>& fn)

If an attempt is made to put() a value for a non-existent key, then
this function is used as a factory to create a new
dynamic_property_map for those values. You can use this mechanism to
prevent exceptions:

1) Create a class that derives from dynamic_property_map but does
nothing interesting with get or put
2) Create a factory function that returns
std::auto_ptr<dynamic_property_map> of these objects
3) Pass this as the argument to your dynamic_property_map constructor.

HTH,
ron

On Jan 11, 2007, at 7:35 PM, Jeffrey Holle wrote:

> I'm using the post 1.31.1 version of boost, which has a much nicer
> read_graphviz function.
>
> I'm wondering if there is a way to "ignore" unwanted properties,
> something akin to sending them to /dev/null.
>
> My present experience is that if an unexpected property is found, an
> exception is thrown.
>
> Is there a way to express that a given property is to be ignored?
>
> Better yet, is there a way to say that all unexpected properties
> are to
> be ignored?
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users



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