On Mon, Nov 29, 2010 at 12:53 AM, Max Motovilov <max@motovilov.net> wrote:
Here's a seemingly simple problem that I have spent most of my Thanksgiving weekend on, and still don't have enough to boast:

Given:

1. A Boost.Fusion-compatible sequence;
2. An integral value i computed at runtime, known to be within
  0..size(sequence);

Weird, this is the second time I've recommended the following in a week -- the easiest way to do what you want is with Steven Watanabe's switch utility. It was up for review a couple years ago and was accepted pending some changes but I don't think it was ever updated

Documentation: http://dancinghacker.com/switch/
and you can get it from the Boost vault here: http://tinyurl.com/23qn7w  

--
-Matt Calabrese