Can you help me convert this for c++17?

Hi guys

This code is deprecated, I would like to convert it for C++17
If I understand correctly I should use a lambda instead of bind2nd, it should be pretty easy but I can't make it work.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
struct isLive : public std::binary_function<CardSet,
                                            CardSet,
                                            bool>
{
    bool operator()(const CardSet& c, const CardSet& dead) const
    {
        return !dead.contains(c);
    }
};


void remove(const CardSet& cards)
{
    int decr = CardSet(cards | dead()).size();
    stable_partition(_deck.begin(), _deck.end(), bind2nd(isLive(), cards));
    _current = STANDARD_DECK_SIZE - decr;
}


This question is off topic but do you know a c++17/c++20 book/resource where I can learn from?
I have experience with more high level programming languages so I need a book (or resource) that explain the new concepts and goes a little deeper with memory, pointers, references and this kind of stuff. I understand the old c++ basics but I'm always worried I make some stupid mistake. I want to understand this language to the very core
Nevermind
 
stable_partition(_deck.begin(), _deck.end(), [cards](const CardSet& c) { return !cards.contains(c); });
Last edited on
Topic archived. No new replies allowed.