[Home]Utility Notes

BOOST WIKI | RecentChanges | Preferences | Page List | Links List

This page is for discussion of the Boost utility library -- problems, bugs, suggestions, tips, etc.


Suggestion

I find it tedious to write out things like

    for_each(container.begin(), container.end(), whatever...);

Not only does it take alot of typing, but it is also error-prone -- e.g. you might change the first "container" to "container2", but forget to change the second one.

There should be a standard for_all(), with definitions like this:

    template <typename T, typename F> void for_all(vector<T>& vec, F func) {
        for_each(vec.begin(), vec.end(), func);
    }

    template <typename T, typename F> void for_all(list<T>& vec, F func) {
        for_each(vec.begin(), vec.end(), func);
    }

    ....

    - Chuck

BOOST WIKI | RecentChanges | Preferences | Page List | Links List
Edit text of this page | View other revisions
Last edited February 1, 2005 4:13 pm (diff)
Search:
Disclaimer: This site not officially maintained by Boost Developers