drinkmystery / mili

Automatically exported from code.google.com/p/mili
Boost Software License 1.0
0 stars 0 forks source link

Vector utilities minimal library #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Please create a vector-utils mili library, with the following basic
(initial) functionality:
 - filtering out: remove elements with indexes specified in a vector of indexes
 - filtering in: remove elements with indexes NOT specified in a vector of
indexes.

This can then be used with stream-utils to select a subset of columns.

I suggest using a set<size_t> for the column numbers, then use find-utils
to test if a given column is present in the set.

Original issue reported on code.google.com by danielgutson@gmail.com on 1 Jun 2009 at 5:39

GoogleCodeExporter commented 9 years ago
The interface of such functionality could look like:
   vector filter(const vector&, const set<size_t>& columns)  - returns the updated
vector; parameter remains untouched.

   vector& filter(vector&, const set<size_t>& columns, IN_PLACE)   - in place action.
vector& is returned.

In order to specify the complementary, the ! operator can be overloaded, thus 
calling:
    filter(v, !columns);

Original comment by danielgutson@gmail.com on 1 Jun 2009 at 5:48

GoogleCodeExporter commented 9 years ago
Library created (previously known as 'find-utils').

Original comment by danielgutson@gmail.com on 6 Jun 2009 at 10:38