Boost logo

Boost :

From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2006-06-22 13:07:38


On 6/20/06, Emil Dotchevski <emildotchevski_at_[hidden]> wrote:
> Hello,

Hi Emil,

[snipped]

I liked very much your idea, but something bothers me.

>
> catch( read_error & x )
> {
> if( info * xi = dynamic_cast<info *>(&x) )
> if( file_name * fn = xi->get<file_name>() )
> ......
> }

IMO, this dynamic_cast should be hided by the library.
How about:

catch(read_error& x)
{
  if(info i = try_get_info(x))
  {
    // ... do something.
  }
}

There should be a way to inspect what there's in the info object too, IMHO.

I liked the << operator too for the throw statement.

[snipped]

> --Emil

-- 
Felipe Magno de Almeida

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