1 #ifndef __REMOVE_LAST_H__
2 #define __REMOVE_LAST_H__
4 #include <vector>
5 #include <glib.h>
7 template<class T>
8 inline void remove_last(std::vector<T> &seq, T const &elem)
9 {
10 using std::vector;
12 typename vector<T>::reverse_iterator i(find(seq.rbegin(), seq.rend(), elem));
13 g_assert( i != seq.rend() );
14 typename vector<T>::iterator ii(&*i);
15 seq.erase(ii);
16 }
19 #endif /* !__REMOVE_LAST_H__ */
22 /*
23 Local Variables:
24 mode:c++
25 c-file-style:"stroustrup"
26 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
27 indent-tabs-mode:nil
28 fill-column:99
29 End:
30 */
31 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :