std::ptr_fun replacement for c++17

后端 未结 6 2126
無奈伤痛
無奈伤痛 2021-02-04 00:11

I am using std::ptr_fun as follows:

static inline std::string <rim(std::string &s) {
    s.erase(s.begin(), std::find_if(s.begin(), s.end(         


        
6条回答
  •  遥遥无期
    2021-02-04 00:38

    Just use a lambda:

    [](unsigned char c){ return !std::isspace(c); }
    

    Note that I changed the argument type to unsigned char, see the notes for std::isspace for why.

    std::ptr_fun was deprecated in C++11, and will be removed completely in C++17.

提交回复
热议问题