std::remove_if - lambda, not removing anything from the collection
问题 Ok, I expect I've made a dumb mistake here. I have a list of DisplayDevice3d and each DisplayDevice3d contains a list of DisplayMode3d. I want to remove all items from the list of DisplayDevice3d that don't have any DisplayMode3d's. I'm trying to use a Lambda to do it, ie.: // If the device doesn't have any modes, remove it. std::remove_if(MyDisplayDevices.begin(), MyDisplayDevices.end(), [](DisplayDevice3d& device) { return device.Modes.size() == 0; } ); Even though out of 6 DisplayMode3d's