bsl::erase_if

erase_if overloads

Synopses

Declared in <bslstl_deque.h>

Erase every element of deq that satisfies predicate.

template<
    class VALUE_TYPE,
    class ALLOCATOR,
    class PREDICATE>
deque<VALUE_TYPE, ALLOCATOR>::size_type
erase_if(
    deque<VALUE_TYPE, ALLOCATOR>& deq,
    PREDICATE predicate);
» more...

Erase all elements in l that satisfy the specified predicate.

template<
    class VALUE,
    class ALLOCATOR,
    class PREDICATE>
bsl::list<VALUE, ALLOCATOR>::size_type
erase_if(
    list<VALUE, ALLOCATOR>& l,
    PREDICATE predicate);
» more...

Erase all the elements in the specified vector vec that satisfy the specified predicate predicate. Return the number of elements erased.

template<
    class VALUE_TYPE,
    class ALLOCATOR,
    class PREDICATE>
vector<VALUE_TYPE, ALLOCATOR>::size_type
erase_if(
    vector<VALUE_TYPE, ALLOCATOR>& vec,
    PREDICATE predicate);
» more...

Erase all characters matching a predicate from a string.

template<
    class CHAR_TYPE,
    class CHAR_TRAITS,
    class ALLOCATOR,
    class UNARY_PREDICATE>
bsl::basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>::size_type
erase_if(
    basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& str,
    UNARY_PREDICATE const& pred);
» more...

Erase all elements in ms that satisfy predicate.

template<
    class KEY,
    class COMPARATOR,
    class ALLOCATOR,
    class PREDICATE>
bsl::multiset<KEY, COMPARATOR, ALLOCATOR>::size_type
erase_if(
    multiset<KEY, COMPARATOR, ALLOCATOR>& ms,
    PREDICATE predicate);
» more...

Erase all elements in s that satisfy predicate.

template<
    class KEY,
    class COMPARATOR,
    class ALLOCATOR,
    class PREDICATE>
bsl::set<KEY, COMPARATOR, ALLOCATOR>::size_type
erase_if(
    set<KEY, COMPARATOR, ALLOCATOR>& s,
    PREDICATE predicate);
» more...

Erase every element of m that satisfies predicate.

template<
    class KEY,
    class VALUE,
    class COMPARATOR,
    class ALLOCATOR,
    class PREDICATE>
bsl::map<KEY, VALUE, COMPARATOR, ALLOCATOR>::size_type
erase_if(
    map<KEY, VALUE, COMPARATOR, ALLOCATOR>& m,
    PREDICATE predicate);
» more...

Erase every element of m that satisfies predicate.

template<
    class KEY,
    class VALUE,
    class COMPARATOR,
    class ALLOCATOR,
    class PREDICATE>
bsl::multimap<KEY, VALUE, COMPARATOR, ALLOCATOR>::size_type
erase_if(
    multimap<KEY, VALUE, COMPARATOR, ALLOCATOR>& m,
    PREDICATE predicate);
» more...

Erase all elements in ms that satisfy predicate.

template<
    class KEY,
    class HASH,
    class EQUAL,
    class ALLOCATOR,
    class PREDICATE>
bsl::unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
erase_if(
    unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& ms,
    PREDICATE predicate);
» more...

Erase elements from s that satisfy predicate.

template<
    class KEY,
    class HASH,
    class EQUAL,
    class ALLOCATOR,
    class PREDICATE>
bsl::unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::size_type
erase_if(
    unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& s,
    PREDICATE predicate);
» more...

Erase every element of m that satisfies predicate.

template<
    class KEY,
    class VALUE,
    class HASH,
    class EQUAL,
    class ALLOCATOR,
    class PREDICATE>
bsl::unordered_map<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
erase_if(
    unordered_map<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& m,
    PREDICATE predicate);
» more...

Erase every element of m that satisfies predicate.

template<
    class KEY,
    class VALUE,
    class HASH,
    class EQUAL,
    class ALLOCATOR,
    class PREDICATE>
bsl::unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
erase_if(
    unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& m,
    PREDICATE predicate);
» more...

Return Value

  • number of elements erased
  • number of characters erased

Parameters

NameDescription
deqdeque from which matching elements are erased
predicateunary predicate selecting elements to erase
llist from which to erase elements
vecvector to modify
strstring to modify
predunary predicate selecting characters to erase
msmultiset from which to erase elements
sset from which to erase elements
mmap from which matching elements are erased