Boost logo

Boost Users :

From: dan marsden (danmarsden_at_[hidden])
Date: 2007-10-18 03:05:00


>I would like to make a subset view of the element in a tuple. It >would, for example, give me a view into the first, third, and fifth >element of the tuple. It isn't clear how to do this with the available >views. You could do the following (untested): * Use zip to zip an mpl range of numeric indexes to your sequence * Use filter to extract the positions you want, based on the indices zipped on above * Use transform to remove the position labels so the sequence elements are just your desired data. The above works only if you need const access, as the algorithms return views to const data. If you need non-const data, you can use the corresponding views. The above is somewhat awkward, if there is some criteria other than position index that can be used to extract your elements, you may be able to do a lot better. Or you could choose different data structures to start off with, for example if you really have 2 subsets of elements, sub0 and sub1, and you know they're separate, store them in 2 fusion containers, and when you need to work on the whole, use fusion::join to glue them together. HTH Cheers Dan ___________________________________________________________ Yahoo! Answers - Got a question? Someone out there knows the answer. Try it now. http://uk.answers.yahoo.com/


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