Utility Rack
Loading...
Searching...
No Matches
erase_where.hpp File Reference

Convenience functions for the erase-remove idiom in C++. More...

#include <algorithm>
#include <utility>
Include dependency graph for erase_where.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename C >
auto chops::erase_where (C &c, const typename C::value_type &val)
 
template<typename C , typename F >
auto chops::erase_where_if (C &c, F &&f)
 

Detailed Description

Convenience functions for the erase-remove idiom in C++.

It's a common error to forget to erase an element from a container after calling remove. This wraps the two calls together.

Note
Thanks goes to Richard Hodges. Most of this code is copied directly from a post of his on StackOverflow.
Authors
Richard Hodges, Cliff Green

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)