/tmxparser/src/TmxUtil.cpp:49:93: error: ‘std::pointer_to_unary_function<_Arg, _Result> std::ptr_fun(_Result (*)(_Arg)) [with _Arg = int; _Result = int]’ is deprecated: use 'std::function' instead [-Werror=deprecated-declarations]
49 | s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/functional:49,
from /home/peter/diverse/programmering/opengl/tmxparser/src/TmxUtil.cpp:31:
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/stl_function.h:1126:5: note: declared here
1126 | ptr_fun(_Result (*__x)(_Arg))
| ^~~~~~~
/home/peter/diverse/programmering/opengl/tmxparser/src/TmxUtil.cpp:49:70: error: ‘constexpr std::unary_negate<_Predicate> std::not1(const _Predicate&) [with _Predicate = pointer_to_unary_function<int, int>]’ is deprecated: use 'std::not_fn' instead [-Werror=deprecated-declarations]
49 | s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/stl_function.h:1046:5: note: declared here
1046 | not1(const _Predicate& __pred)
| ^~~~
/home/peter/diverse/programmering/opengl/tmxparser/src/TmxUtil.cpp: In function ‘std::string& Tmx::rtrim(std::string&)’:
/home/peter/diverse/programmering/opengl/tmxparser/src/TmxUtil.cpp:55:84: error: ‘std::pointer_to_unary_function<_Arg, _Result> std::ptr_fun(_Result (*)(_Arg)) [with _Arg = int; _Result = int]’ is deprecated: use 'std::function' instead [-Werror=deprecated-declarations]
55 | s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/stl_function.h:1126:5: note: declared here
1126 | ptr_fun(_Result (*__x)(_Arg))
| ^~~~~~~
/home/peter/diverse/programmering/opengl/tmxparser/src/TmxUtil.cpp:55:61: error: ‘constexpr std::unary_negate<_Predicate> std::not1(const _Predicate&) [with _Predicate = pointer_to_unary_function<int, int>]’ is deprecated: use 'std::not_fn' instead [-Werror=deprecated-declarations]
55 | s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/stl_function.h:1046:5: note: declared here
1046 | not1(const _Predicate& __pred)
| ^~~~
cc1plus: all warnings being treated as errors
The ptr_fun has been deprecated in C++11 and removed in C++17. I built the code using the standard CMake settings (cxx_cpp11) but it still seems to fail.
There is currently a compilation error on GCC 12.2.1, for
ptr_fun is deprecated.The ptr_fun has been deprecated in C++11 and removed in C++17. I built the code using the standard CMake settings (cxx_cpp11) but it still seems to fail.
See
https://en.cppreference.com/w/cpp/utility/functional/ptr_fun
And a possible solution here:
https://stackoverflow.com/questions/44973435/stdptr-fun-replacement-for-c17
Fixed in PR #85