remove-last.h revision 6938feff2ed2fb2c1e88641a89864bc744361802
5058N/A#ifndef __REMOVE_LAST_H__
5058N/A#define __REMOVE_LAST_H__
5058N/A
5058N/A#include <algorithm>
5058N/A#include <vector>
5058N/A#include <glib.h>
5058N/A
5058N/Atemplate<class T>
5058N/Ainline void remove_last(std::vector<T> &seq, T const &elem)
5058N/A{
5058N/A typename std::vector<T>::reverse_iterator i(find(seq.rbegin(), seq.rend(), elem));
5058N/A g_assert( i != seq.rend() );
5058N/A seq.erase(i.base());
5058N/A}
5058N/A
5058N/A
5058N/A#endif /* !__REMOVE_LAST_H__ */
5058N/A
5058N/A
5058N/A/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :