Boost logo

Boost :

From: dan marsden (danmarsden_at_[hidden])
Date: 2008-01-05 16:21:23

Hi Another question about the design / docs for the switch library under review. From what I understand switch takes a runtime integral value, uses a PP generated switch statement, and calls out using some sort of MPL integral constant to specify the switch case to be served. This is pretty cool, as we seem to be travelling back from runtime into compile time world. The documentation is not specific about which specific type (e.g. mpl::int_<1> for case 1 matching in the underlying switch statement) is going to be used. It looks to me like it would be convenient to overload operator() for each case I want to service, but this will be awkward to do without knowing the exact type that will be incoming. Otherwise I'm going to have to use enable_if or something to separate out the cases, which seems unnecessarily awkward. The example provided is fortunate that it behaves uniformly for each incoming value, so only 1 overload of operator() is required. IMO this will not be the common case, an example with differing behaviour would be helpful. I think the documentation could do with a bit of clarification in this area. Cheers Dan ___________________________________________________________ Support the World Aids Awareness campaign this month with Yahoo! For Good

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