Boost logo

Boost :

From: Vesa Karvonen (vesa_karvonen_at_[hidden])
Date: 2002-04-10 02:58:08

Andrei Alexandrescu:
>I'd like to propose making 'any' visitable. Without visitation, all
>you can do to query the type of any is to do it explicitly, which is
>awkward and error-prone.
>With visitation, one can add processing to any that is nicely
>decoupled. (By the way, due to the nature of 'any', it seems like only
>acyclic visitation will do - the classic GoF visitor won't work.)
>So, in a nutshell - do you guys think it's a good idea?

A visitor mechanism would be nice. Another desirable feature would be
pattern matching to allow inspecting any objects:

  [ case_<int> ( a_function_like_object_of_one_int_parameter )
  | case_<float> ( a_function_like_object_of_one_float_parameter )
  | default_ ( a_function_like_object_of_zero_parameters )

The function like objects could then be implemented using the lambda
library, for instance.

Join the world’s largest e-mail service with MSN Hotmail.

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