Questions tagged [remove-if]

Common Lisp 'remove-if' function.

Common Lisp 'remove-if' function.

It's signature is:

remove-if test sequence &key from-end start end count key => result-sequence

CLHS: remove-if

201 questions
2
votes
2 answers

remove_if string matches a given string in a set

I was thinking about using remove_if on a vector of strings as follows in the pseudo code below: for(some strings in a given set) { remove_if(myvec.begin(), myvec.end(), string_matches_current_string); } Now, I am aware I can define the…
squashed.bugaboo
  • 1,338
  • 2
  • 20
  • 36
1
vote
1 answer

I don't understand how to do a remove_if not in c++

This code works but it is a bit limited so I want to remove something if it is not equal to a letter. I know that I have to use ::isalpha instead of ::ispunct but I don't understand how to make it remove if it is not equal to :: isalpha. I have…
bobthemac
  • 1,172
  • 6
  • 26
  • 59
1
vote
2 answers

C++ remove_if overwriting my vector

My remove_if seems to be overwriting the elements that are not filtered out with values of filtered out elements. The purpose of these code is to allow user to filter and display only teacher from a certain category. (Not deleting any element) Here…
delphi316
  • 201
  • 2
  • 4
  • 10
1
vote
3 answers

C++ Regarding pointer/reference with remove_if

I'm trying to use remove_if to remove elements in my vector to do filtering. The problem is when I compile the coding, there were no error but when I try to use the filter function, error popped out saying I can't dereference an iterator. I have no…
delphi316
  • 201
  • 2
  • 4
  • 10
1
vote
4 answers

How do delete items in a vector if using remove_if and items are pointers to objects?

I fear that I am running into memory leak issues by doing the following: (Sample code) class myItem //random container stuff mostly. All primatives. { int index; char* name; int val1; int val2; }; class vecList { vector<…
Jordan
  • 9,014
  • 8
  • 37
  • 47
1
vote
1 answer

using erase and remove-if: passing more than one argument to function

I would like to iterate and erase items from std::vector, but I wish to compare each item to previous and next items in the vector and to perform some calculations. If a certain condition is met, item will be erased. Is it possible to pass more than…
1
vote
1 answer

xslt remove item if subnode doesn't exist

I have the following input xml. 001
a01
1
vote
1 answer

How to remove entire rows depending if certain columns have NULL or not - Power BI Query

I have an unpivoted table in the Power BI Query with +20 columns and +10000 rows. The first columns are related to KPI name, month, and other data of interest. The columns after are the columns that contain the actual values I want to display. Some…
rlsrls
  • 69
  • 1
  • 4
1
vote
1 answer

"Operator '<' cannot be applied to '', 'int' " in java

I met a problem about doing operation between a lambda parameter and a int. Codes are written as follows: HashMap testMap = new HashMap<>(); testMap.put(1, 1); testMap.put(2, 2); testMap.entrySet().removeIf((key, value) -> value <…
NormalLLer
  • 183
  • 2
  • 11
1
vote
1 answer

How to use remove_if on an std::list of structs when you want to compare to a member variable of the struct

I have an std::list of structs and I would like to remove items from the list based on if a certain member variable matches a particular value. My struct and list: struct Foo { uint64_t PID; uintptr_t addr; }; std::list FooList; Code to…
Naitzirch
  • 45
  • 1
  • 2
  • 6
1
vote
2 answers

Remove method for Binary Search Tree

I am working on a lab that requires me to create a remove method for a binary search tree. Here is my code for my remove method. public void remove(T r) { remove(root, r); } private TreeNode remove(TreeNode tree, T r) { …
george1029
  • 21
  • 2
1
vote
2 answers

Java removeIf condition in for loop

In first list I have 3 Plans. In second list I have 3 Tarifs. I should to check every tariff and remove it from Plans if type not equals "L". In my case I have 2 tarifs which I need to remove. But problem is that when the first plan are been…
Deividas.r
  • 17
  • 1
1
vote
1 answer

Matlab: Remove rows when first and last 2 elements are shuffled

I have a matrix where each element is a single unit of a 2d coordinate. As such, each element in any given row are paired, where elements in the first column are paired with those in the second, and elements in the third column paired with the…
1
vote
1 answer

Remove an entry from a List based on the value of of a specific index

I have a list of ints like the following one: 1318 1065 0 1392 1109 0 1522 1114 2 1764 1134 0 1643 1172 0 1611 1141 0 1608 1142 4 1689 1180 0 1546 1144 0 1811 1121 1 1682 1144 0 1687 1203 0 1751 1138 0 1702 1227 0 My goal is to keep only entries…
J.Doe
  • 529
  • 4
  • 14
1
vote
1 answer

Using forEach and RemoveIf if used together will it cause ConcurrentModificationException?

I have three classes (With getters and Setters) Student (Class) String studentName; int sid; List Employee (Class) String employeeName; int eid; List Admin (Class) String name; int adminId; public class…
JavaLearner1
  • 607
  • 2
  • 8
  • 21