Sign in to follow this  
Eelco

View Library

Recommended Posts

I was writing some code that involves a lot of lazy filtering of data. As i was writing this, i started to feel like i was reinventing the wheel, and indeed i was. The concept of a 'view' container adaptor as a predicate being applied to a range isnt a new one. So, i want to be able to write stuff like:
View lazy_set_intersection = filter_view(left, predicate_contains(right));
Where view is a container adaptor which iterates over the entries in left, skipping all entries for which the predicate doesnt evaluate to true. So i decided to quit my reinvention of the wheel. I figured that surely, boost must have a solid implementation of something like this included? I find it hard to believe, but it seems the answer is 'no'. All this stuff is included in boost/fusion for friggin metadata containers, but for plain old data containers, it isnt? wtf? STL? No luck either it seems. The best ive found so far is VTL, the View Template Library. It hasnt been updated since 2000, and generally, im not too convinced its all that optimal in terms of boost/stl compliance. Surely i must be missing something here?

Share this post


Link to post
Share on other sites
Quote:
Original post by Gage64
As always, I'm probably missing something obvious, but what about remove_copy_if?


Its not a lazy implementation, it requires memory allocation.

Share this post


Link to post
Share on other sites
On second thought, it seems quite decently designed. Still, it hasnt been updated since 2000, and it has only been downloaded a couple of hundered times since.

That doesnt seem right for something so usefull. Am i really not missing something?

Share this post


Link to post
Share on other sites
Hmm, VTL isnt flexible enough to do what i want to do (which is, operations on unordered maps).

Guess i will have to write it myself then... should be quite easy using boost::filter_iterator

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this